-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Transfer leadership #476
Comments
This is odd. There should be a brief period of time without a leader (<1s) but then a new leader should automatically be elected. Is this not what you are experiencing? |
Correct. I'm not seeing a new leader be elected. I've reproduced this a couple times in our production environment (ug :)) After 3 min of a leaderless cluster I stopped one of the "new" nodes, and brought him back up in bootstrap mode, which made the cluster functional again. Again restarting that same node without bootstrap allowed one of the other "new" nodes to pick up leadership very quickly. We're running v0.4.0, which I see is now not the latest. Also, I noticed this ticket which seemed potentially related? |
Yes, there was an issue in 0.4.0 fixed in 0.4.1 that could explain this behavior. Please try with the latest version, and let us know if its still an issue! |
Thanks @armon. It'll be some days before I can get us upgraded to 0.4.1 but I will most def. report back. |
I have a similar issue. Using the Vagrantfile in francois/consul-playground@642af4d, once the three consul servers are booted, when I interrupt them all (Ctrl+C from the shell), if I don't clean out
Then, I stop consul10, 30 and 20, in that order (20 is the leader):
Now, I will reboot the servers, consul20 (the old leader), then consul10 and 30, in that order:
And the
The only way I will be able to get a leader will be to stop all servers again, then destroy the contents of |
You are probably having the servers gracefully leave, which removes them from the peer set of Raft. Once 2 of the servers are removed, you lose quorum and the cluster goes into an outage. Outage recovery is done via: http://consul.io/docs/guides/outage.html If you hard stop them, or they crash, or power fail, when they restart a new leader will be elected. Graceful leave of all servers will cause an outage. |
Same issue as @francois here, playing around with Consul (0.5.0 now) in a Vagrant environment. @armon I had a look at the outage guide, but the problem is that the content of the peers.json file on all three nodes is the string "null". Removing the file didn't seem to make a difference, nor did restarting the server agents with or without -bootstrap-expect - they simply won't elect a leader without wiping my data directory. |
Played with this a little more - I can get it to elect a new leader if I start two nodes without any bootstrap information, then start the third node with -bootstrap -join=OtherNodeIP Not sure if this is perhaps a unique situation? |
@AirbornePorcine If the peers file is blank, this means you had the nodes do a graceful leave. This is expected behavior. If the nodes leave, you don't want them to disrupt the existing cluster unless they rejoin. You would have to use the The |
Great, thanks @armon ! |
@ctro never responded back with his experience unfortunately, but we're running a very similar immutable setup and have run into the same situation with 0.5.0. Is there a suggested process to follow here? I do not fully understand why the cluster goes into outage mode when during the upgrade process we balloon out from cluster size of 3 to 6 nodes (1 leader, 5 peers). Shouldn't we never lose quorum if we have six nodes and then shutdown the older nodes thus returning us to a size of three? Should I force-leave the old nodes instead? |
@plombardi89 It depends on how you are removing the older nodes. If they do not leave gracefully, then they are still part of the raft replication group. This means only 3 of 6 members are reachable and quorum is lost. If they leave gracefully or you remove one, then force leave, remove another, etc, then it will be okay as well. As it stands you are dividing the cluster in half, and it is no longer able to safely commit new transactions. |
@plombardi89 @armon, at this point I'll leave closing this issue up to you... |
Add icon to chart.yaml
Remove the cleanup controller and replace it with the supporting logic from hashicorp#457.
I'm running an immutable infrastructure, of which our Consul Cluster is a part. Sometimes we need to upgrade our consul cluster, perhaps because the underlying OS has needed updates.
It's super easy to spin up new nodes and join them to the existing cluster. It's also super easy to
consul leave
the old nodes that aren't leader. Everything just works.But running
consul leave
on the "old" cluster's leader leaves us with a "new", but leaderless cluster.It would be great if there were some sort of leadership transfer command that would allow me to transfer cluster leadership to one of the "new" nodes before running
consul leave
on the last remaining "old" node.The text was updated successfully, but these errors were encountered: