ZooKeeper: Install

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.

 

Download from offical websit  http://zookeeper.apache.org/

 

#tar -zxf zookeeper-3.4.6.tar.gz

#cd zookeeper-3.4.6

 

 

----conf/zoo.cfg------

 standalone mode

tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181

 

Replicated mode

tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=zhj-c0:2888:3888
server.2=zhj-c1:2888:3888
server.3=zhj-c2:2888:3888

Distributed the zookeeper dir to all zookeeper nodes

 

Set ZOOKEEPER_HOME and PATH in ~/.bashrc

 

Start ZooKeeper

zkServer.sh start

 

Connecting to ZooKeeper

zkCli.sh -server 127.0.0.1:2181

 

 

 

 

Running Replicated ZooKeeper

 

 


ZooKeeper: Install_第1张图片
Solution:The reason is that the myid file doesn't exist, you should create the myid file and put the corressponding id  in the file in every node of zookeeper cluster. Meanwhile, the dataDir should be created manually first.

Till to now, I start the zookeeper cluster successfully by runing the zkServer.sh start on very node by manually. There maybe a shutcut to start all servers by some command or script.

see:http://docs.ngdata.com/lilyenterprise-docs-1_0/471-lily/493-lily.html

 

Note:For reliable ZooKeeper service, you should deploy ZooKeeper in a cluster known as an ensemble. As long as a majority of the ensemble are up, the service will be available. Because Zookeeper requires a majority, it is best to use an odd number of machines

 

references:

http://zookeeper.apache.org/doc/r3.4.6/zookeeperAdmin.html

你可能感兴趣的:(zookeeper)