From 14a84f4a4f3724459225fa4eafeb518acede9a71 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Fri, 16 May 2014 10:49:36 -0700 Subject: [PATCH] agent: Support -advertise cli flag. Fixes #156. --- command/agent/command.go | 2 ++ website/source/docs/agent/options.html.markdown | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/command/agent/command.go b/command/agent/command.go index f397026e1..70a0387b3 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -57,6 +57,7 @@ func (c *Command) readConfig() *Config { cmdFlags.StringVar(&cmdConfig.ClientAddr, "client", "", "address to bind client listeners to (DNS, HTTP, RPC)") cmdFlags.StringVar(&cmdConfig.BindAddr, "bind", "", "address to bind server listeners to") + cmdFlags.StringVar(&cmdConfig.AdvertiseAddr, "advertise", "", "address to advertise instead of bind addr") cmdFlags.IntVar(&cmdConfig.Protocol, "protocol", -1, "protocol version") @@ -467,6 +468,7 @@ Usage: consul agent [options] Options: + -advertise=addr Sets the advertise address to use -bootstrap Sets server to bootstrap mode -bind=0.0.0.0 Sets the bind address for cluster communication -client=127.0.0.1 Sets the address to bind for client access. diff --git a/website/source/docs/agent/options.html.markdown b/website/source/docs/agent/options.html.markdown index 196f8a51a..1cd445759 100644 --- a/website/source/docs/agent/options.html.markdown +++ b/website/source/docs/agent/options.html.markdown @@ -26,6 +26,13 @@ are documented below. The options below are all specified on the command-line. +* `-advertise` - The advertise address is used to change the address that we + advertise to other nodes in the cluster. By default, the `-bind` address is + advertised. However, in some cases, there may be a routable address that cannot + be bound to. This flag enables gossiping a different address to support this. + If this address is not routable, the node will be in a constant flapping state, + as other nodes will treat the non-routability as a failure. + * `-bootstrap` - This flag is used to control if a server is in "bootstrap" mode. It is important that no more than one server *per* datacenter be running in this mode. The initial server **must** be in bootstrap mode. Technically, a server in bootstrap mode is allowed to self-elect as the Raft leader. It is important @@ -150,12 +157,7 @@ definitions support being updated during a reload. * `ui_dir` - Equivalent to the `-ui-dir` command-line flag. -* `advertise_addr` - The advertise address is used to change the address that we - advertise to other nodes in the cluster. By default, the `-bind` address is - advertised. However, in some cases, there may be a routable address that cannot - be bound to. This flag enables gossiping a different address to support this. - If this address is not routable, the node will be in a constant flapping state, - as other nodes will treat the non-routability as a failure. +* `advertise_addr` - Equivalent to the `-advertise` command-line flag. * `ca_file` - This provides a the file path to a PEM encoded certificate authority. The certificate authority is used to check the authenticity of client and server