1.下载 zookeeper : http://mirror.bit.edu.cn/apache/zookeeper/
2. 解压: tar -zxvf **** /.../zookeeper
3. 进入config目录 cp zoo_sample.cfg zoo.cfg
4. 修改zoo.cfg配置
- # The number of milliseconds of each tick
- tickTime=2000
- # The number of ticks that the initial
- # synchronization phase can take
- initLimit=10
- # The number of ticks that can pass between
- # sending a request and getting an acknowledgement
- syncLimit=5
- # the directory where the snapshot is stored.
- dataDir=/.../zookeeper/data
- dataLogDir=/.../zookeeper/log
- # the port at which the clients will connect
- clientPort=2181
5. 添加环境变量
6. 启动zookeeper ./zkServer.sh start 停止: ./zkServer.sh stop
root@iZbp160z8sb56y5j9b3ljfZ:/home/zookeeper/zookeeper-3.4.8/bin# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
7. 测试zookeeper ./zkCli.sh -server 116.62.48.243:2181
root@iZbp160z8sb56y5j9b3ljfZ:/home/zookeeper/zookeeper-3.4.8/bin# ./zkCli.sh -server 116.62.48.243:2181
Connecting to 116.62.48.243:2181
2017-07-13 11:28:17,584 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2017-07-13 11:28:17,589 [myid:] - INFO [main:Environment@100] - Client environment:host.name=iZbp160z8sb56y5j9b3ljfZ
2017-07-13 11:28:17,590 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_111
2017-07-13 11:28:17,592 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2017-07-13 11:28:17,593 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/home/zousheng/jdk1.8.0_111/jre