Assume that I have an ensemble Zookeeper which is up and running to facilitate and serve Apache Kafka (Confluent's distribution).
3 instances (clientPorts: 2181, 2182 and 2183) have been configured and started as shown below:
./bin/zookeeper-server-start etc/kafka/zookeeper.properties
./bin/zookeeper-server-start etc/kafka/zookeeper1.properties
./bin/zookeeper-server-start etc/kafka/zookeeper2.properties
At any given time, how can I check which Zookeeper instance is the leader of the ensemble?
There are a few ways to find the leader of an ensemble. The easiest is probably to simply ask the Zookeeper instances using:
echo stat | nc ZOOKEEPER_IP ZOOKEEPER PORT | grep Mode
that will print whether this instance is a leader, follower or standalone.
This page also shows how to find this out from Zookeeper's logs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With