Jun Rao wrote:

From the ZK web site, it's not clear how to set up a multi-node ZK service.
It seems that one has to add the server entries in the conf file and create
myid files on each node. Then, how should I start the ZK nodes? I tried
issuing "zkServer start" from each node and that didn't seem to work. Is
that the right way to start the service? Also, once the service is up, is
there a way to check the list of nodes used by ZK and which node is the
leader? Thanks,


See this for a step-by-step guide:
http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html#sc_zkMulitServerSetup
In particular steps 4 & 5.

your config should look something like (for 3 server ensemble):
tickTime=2000
dataDir=/path/to/data/dir
clientPort=2181
initLimit=5
syncLimit=2
server.1=host1.foo.com:2888:2889
server.2=host2.foo.com:2888:2889
server.3=host3.foo.com:2888:2889

this file needs to exist (available to) each of the servers in the ensemble. Try the command line listed in step 5 to start the server (conf in the classpath is there to pickup the log4j configuration, you could use that to debug). The myid file needs to exist in each server's dataDir (not shared of course).

Either JMX, the logs, or the stat command documented here:
http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html#sc_zkCommands
will give insight on things like which server is the leader. The stat command is the simplest (nc to the clientPort of the server and issue the stat command).

Patrick

Reply via email to