Make Serf LAN & WAN port configurable from CLI
Make RPC port accessible to CLI Add tests and documentation for server-port, serf-lan-port, serf-wan-port CLI arguments
This commit is contained in:
parent
dc314c3229
commit
5290d69cb3
|
@ -56,6 +56,7 @@ func AddFlags(fs *flag.FlagSet, f *Flags) {
|
|||
add(&f.Config.AdvertiseAddrLAN, "advertise", "Sets the advertise address to use.")
|
||||
add(&f.Config.AdvertiseAddrWAN, "advertise-wan", "Sets address to advertise on WAN instead of -advertise address.")
|
||||
add(&f.Config.BindAddr, "bind", "Sets the bind address for cluster communication.")
|
||||
add(&f.Config.Ports.Server, "server-port", "Sets the server port to listen on.")
|
||||
add(&f.Config.Bootstrap, "bootstrap", "Sets server to bootstrap mode.")
|
||||
add(&f.Config.BootstrapExpect, "bootstrap-expect", "Sets server to expect bootstrap mode.")
|
||||
add(&f.Config.ClientAddr, "client", "Sets the address to bind for client access. This includes RPC, DNS, HTTP and HTTPS (if configured).")
|
||||
|
@ -91,8 +92,10 @@ func AddFlags(fs *flag.FlagSet, f *Flags) {
|
|||
add(&f.Config.RetryJoinMaxAttemptsLAN, "retry-max", "Maximum number of join attempts. Defaults to 0, which will retry indefinitely.")
|
||||
add(&f.Config.RetryJoinMaxAttemptsWAN, "retry-max-wan", "Maximum number of join -wan attempts. Defaults to 0, which will retry indefinitely.")
|
||||
add(&f.Config.SerfBindAddrLAN, "serf-lan-bind", "Address to bind Serf LAN listeners to.")
|
||||
add(&f.Config.Ports.SerfLAN, "serf-lan-port", "Sets the Serf LAN port to listen on.")
|
||||
add(&f.Config.SegmentName, "segment", "(Enterprise-only) Sets the network segment to join.")
|
||||
add(&f.Config.SerfBindAddrWAN, "serf-wan-bind", "Address to bind Serf WAN listeners to.")
|
||||
add(&f.Config.Ports.SerfWAN, "serf-wan-port", "Sets the Serf WAN port to listen on.")
|
||||
add(&f.Config.ServerMode, "server", "Switches agent to server mode.")
|
||||
add(&f.Config.EnableSyslog, "syslog", "Enables logging to syslog.")
|
||||
add(&f.Config.UI, "ui", "Enables the built-in static web UI server.")
|
||||
|
|
|
@ -48,6 +48,18 @@ func TestParseFlags(t *testing.T) {
|
|||
args: []string{`-dns-port`, `1`},
|
||||
flags: Flags{Config: Config{Ports: Ports{DNS: pInt(1)}}},
|
||||
},
|
||||
{
|
||||
args: []string{`-serf-lan-port`, `1`},
|
||||
flags: Flags{Config: Config{Ports: Ports{SerfLAN: pInt(1)}}},
|
||||
},
|
||||
{
|
||||
args: []string{`-serf-wan-port`, `1`},
|
||||
flags: Flags{Config: Config{Ports: Ports{SerfWAN: pInt(1)}}},
|
||||
},
|
||||
{
|
||||
args: []string{`-server-port`, `1`},
|
||||
flags: Flags{Config: Config{Ports: Ports{Server: pInt(1)}}},
|
||||
},
|
||||
{
|
||||
args: []string{`-join`, `a`, `-join`, `b`},
|
||||
flags: Flags{Config: Config{StartJoinAddrsLAN: []string{"a", "b"}}},
|
||||
|
|
|
@ -643,6 +643,19 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
rt.DataDir = dataDir
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "-serf-lan-port",
|
||||
args: []string{
|
||||
`-serf-lan-port=123`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
rt.SerfPortLAN = 123
|
||||
rt.SerfAdvertiseAddrLAN = tcpAddr("10.0.0.1:123")
|
||||
rt.SerfBindAddrLAN = tcpAddr("0.0.0.0:123")
|
||||
rt.DataDir = dataDir
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "-serf-wan-bind",
|
||||
args: []string{
|
||||
|
@ -654,6 +667,19 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
rt.DataDir = dataDir
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "-serf-wan-port",
|
||||
args: []string{
|
||||
`-serf-wan-port=123`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
rt.SerfPortWAN = 123
|
||||
rt.SerfAdvertiseAddrWAN = tcpAddr("10.0.0.1:123")
|
||||
rt.SerfBindAddrWAN = tcpAddr("0.0.0.0:123")
|
||||
rt.DataDir = dataDir
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "-server",
|
||||
args: []string{
|
||||
|
@ -667,6 +693,19 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
rt.DataDir = dataDir
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "-server-port",
|
||||
args: []string{
|
||||
`-server-port=123`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
rt.ServerPort = 123
|
||||
rt.RPCAdvertiseAddr = tcpAddr("10.0.0.1:123")
|
||||
rt.RPCBindAddr = tcpAddr("0.0.0.0:123")
|
||||
rt.DataDir = dataDir
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "-syslog",
|
||||
args: []string{
|
||||
|
|
|
@ -387,6 +387,12 @@ will exit with an error at startup.
|
|||
within its network segment. See the [Network Segments Guide](/docs/guides/segments.html) for more details.
|
||||
By default, this is an empty string, which is the default network segment.
|
||||
|
||||
* <a name="_serf_lan_port"></a><a href="#_serf_lan_port">`-serf-lan-port`</a> - the Serf LAN port to listen on.
|
||||
This overrides the default Serf LAN port 8301. This is available in Consul 1.2.2 and later.
|
||||
|
||||
* <a name="_serf_wan_port"></a><a href="#_serf_wan_port">`-serf-wan-port`</a> - the Serf WAN port to listen on.
|
||||
This overrides the default Serf WAN port 8302. This is available in Consul 1.2.2 and later.
|
||||
|
||||
* <a name="_server"></a><a href="#_server">`-server`</a> - This flag is used to control if an
|
||||
agent is in server or client mode. When provided,
|
||||
an agent will act as a Consul server. Each Consul cluster must have at least one server and ideally
|
||||
|
@ -396,6 +402,9 @@ will exit with an error at startup.
|
|||
participate in a WAN gossip pool with server nodes in other datacenters. Servers act as gateways
|
||||
to other datacenters and forward traffic as appropriate.
|
||||
|
||||
* <a name="_server_port"></a><a href="#_server_port">`-server-port`</a> - the server RPC port to listen on.
|
||||
This overrides the default server RPC port 8300. This is available in Consul 1.2.2 and later.
|
||||
|
||||
* <a name="_non_voting_server"></a><a href="#_non_voting_server">`-non-voting-server`</a> - (Enterprise-only)
|
||||
This flag is used to make the server not participate in the Raft quorum, and have it only receive the data
|
||||
replication stream. This can be used to add read scalability to a cluster in cases where a high volume of
|
||||
|
|
Loading…
Reference in New Issue