Bootstrap Expect Behavior

I have been experimenting with Consul/Nomad as a potential solution to our product. Our solution ships out 4 hosts and I was curious if I startup Consul with systemd on all four with the bootstrap-expect=3 what will happen with the fourth host. My concern is that once all four hosts are discovered (mdns) that I would have a even number of servers. Does consul handle this? It would be great if the bootstrap-expect behavior is that we have only 3 servers and the 4th automatically is made a client. The documentation doesn’t specify this behavior

I have always used the bootstrap_expect on the servers, and also kept the count == no.of servers

I am not sure is leaving out the -server parameter will work.

I’ll let someone from HashiCorp confirm

BTW, servers are usually where the application workload should not run, so as not to overwhelm the Consul/Nomad servers.

“Expected” means that this is the minimum amount to build a cluster/ start leader election.
Additional nodes can join every time.
Consul can handle even numbers of nodes, even if it’s not recommended.

I’ll let someone from HashiCorp confirm.

My assumption from reading the documentation is that if we set the minimum number of servers to 3 is that consul will wait until that number is satisfied. What I am asking is the behavior of consul when the expect is set to 3 and a 4th server joins. That would result in 4 consul servers which is not ideal. I did not know if Hashicorp had code in to set that forth into a client to prevent a even number, that is the ask here

I don’t think so, because a cluster of five nodes is recommended, too. So the bootstrap_expect parameter would be also a maximum or the former client (4th node) will have to be promoted… And what’s the purpose of a client that should be a server instead?

But proof me wrong. :slight_smile:

If you are using bootstrap_expect=3 and are booting 4 servers, all of them are servers. Consul does not convert the 4th to a client. bootstrap_expect just makes the servers wait until there are 3 servers before it starts the leader election between these servers. You can always join more servers after that. Which is basically what happens when you are booting the 4th.

2 Likes