Confirm the election status of a ZooKeeper service

You can determine the election status of a ZooKeeper host if you have installed telner ot netcat and it runs from a host with network access to the ZooKeeper host.

The default ZooKeeper client port is 2181. Run the following command against each ZooKeeper host:
echo "stat" | nc 2181 | grep Mode
For example, a follower host would return the message:
Mode: follower
You can use telnet, if you prefer:
$ telnet 2181
Sample output would be similar to the following:
Connected to
Escape character is '^]'.
Zookeeper version: 3.4.5-cdh5.4.4--1, built on 07/06/2015 23:54 GMT

Latency min/avg/max: 0/1/40
Received: 631
Sent: 677
Connections: 7
Outstanding: 0
Zxid: 0x30000011a
Mode: follower               <----
Node count: 40
Connection closed by foreign host.