unable to determine zookeeper ensemble health

apache-zookeeper, cloudera, hadoop, hbase, solr

Solution

You can use the stat four letter word,

~$echo stat | nc 127.0.0.1 <zkport>

Which gives you output like,

Zookeeper version: 3.4.5-1392090, built on 09/30/2012 17:52 GMT
Clients:
 /127.0.0.1:55829[0](queued=0,recved=1,sent=0)

Latency min/avg/max: 0/0/0
Received: 3
Sent: 2
Connections: 1
Outstanding: 0
Zxid: 0x100000000
Mode: leader
Node count: 4

The `Mode:` line tells you what mode the server is running in, either leader, follower or standalone if the node is not part of a cluster.

Problem

I setup a 3 node Zookeeper cdh4 ensemble on RHEL 5.5 machines. I have started the service by running `zkServer.sh` on each of the nodes. ZooKeeper instance is running on all the nodes, but how do I know if it is a part of an ensemble or are they running as individual services? I tried to start the service and check the ensemble as stated here, on Cloudera's site, but it throws a ClassNotFoundException.

Original source