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

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,包括配置独立模式和集群模式的方法。此外,还详细介绍了启动ZooKeeper服务及连接客户端的过程,并强调了在可靠的服务中使用集群的重要性。
200

被折叠的 条评论
为什么被折叠?



