Linux下安装Zookeeper

1.下载 zookeeper :  http://mirror.bit.edu.cn/apache/zookeeper/

2. 解压: tar -zxvf ****  /.../zookeeper

3. 进入config目录 cp zoo_sample.cfg zoo.cfg

4. 修改zoo.cfg配置

  1. # The number of milliseconds of each tick  
  2. tickTime=2000  
  3. # The number of ticks that the initial  
  4. # synchronization phase can take  
  5. initLimit=10  
  6. # The number of ticks that can pass between  
  7. # sending a request and getting an acknowledgement  
  8. syncLimit=5  
  9. # the directory where the snapshot is stored.  
  10. dataDir=/.../zookeeper/data  
  11. dataLogDir=/.../zookeeper/log  
  12. # the port at which the clients will connect  
  13. clientPort=2181  

 5. 添加环境变量

创建一个环境变量ZOOKEEPER并把该环境变量添加到系统路径:
  vim /etc/profile
 
  在export PATH语句前添加两行:
  ZOOKEEPER=/usr/local/zookeeper/zookeeper-3.4.6
  PATH=$PATH:$ZOOKEEPER/bin
 
  并执行 source /etc/profile

 

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

 

posted on   暗夜——茂茂  阅读(106)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示