Does leader election need to be executed in separate step after setting up 3-machine ensemble?

StackOverflow https://stackoverflow.com/questions/17537847

  •  02-06-2022
  •  | 
  •  

Domanda

I currently have 3 machines in a Zookeeper ensemble - I've already set up the configuration file, and the 3 machines in the ensemble can communicate with each other.

What exactly is leader election? Do I need to use a LeaderLatch to start leader election, or does it happen automatically after correctly setting up the configuration file?

È stato utile?

Soluzione

It's a bit confusing because the Zookeeper server itself has the concept of a leader that it takes care of electing when you set up a ZK ensemble. But that leader is purely internal to ZK. See this post for more details.

If you want leader election for your application then you will need to implement a leader election recipe, either using something like Curator LeaderLatch or rolling your own based on the recipe on the ZK site.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top