Hi
We have 5 Consul servers (1.0.6) and a bunch of agents in our setup. We have lost one of the server nodes and would like to “promote” one of the agents to be a server. Is this as simple as editing /etc/consul.d/config.json, setting server=true and restarting Consul? Or do we have to wipe the data-dir first?
Thanks
David
Hi @david.tinker,
Setting server=true
should be enough to make a Client
agent into a Server
, but there are few things to note before making this change.
-
Server agents have few extra ports that should be open between nodes for them to function properly. So network configuration has to be taken care of before making the switch.
-
8300/tcp
: Server RPC (All clients and servers should be able to talk on this port)
-
8302/tcp&udp
: Serf WAN Port (All servers should be able to talk on this port)
-
If you have enabled TLS and if you have verify_server_hostname
set to true
, then you will have to make sure that the service certificate has server.<datacenter_name>.<domain>
in the SAN. (ref: Configuration | Consul by HashiCorp)
-
Apart from the above two, you may want to consider moving the services registered if any on this node to different servers to make this a Consul server only node (from a performance perspective).
Having said the above, if you can issue a consul leave
, wipe the data-dir, set server=true
, and then start the agent then you (also satisfying the above requirements) can effectively think of it as if you are adding a brand new node.
These are the important points that came to my mind, I will let others add if there is anything that I have missed.
1 Like
Thanks. I ended up stopping consul, changing the config, wiping the data dir and starting it up. Worked seamlessly.
I didn’t think of doing a leave … maybe it did that itself? It was a graceful stop.
Yeah, by default when running as Client
the default terminate behaviour is to leave the cluster (ref: Configuration | Consul by HashiCorp).