Linux 安装zookeeper

一 、下载zookeeper

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz

 

二、解压zookeeper

tar -zxvf zookeeper-3.3.6.tar.gz  

 

三、进入到conf目录

 cd /zookeeper-3.4.11/conf

  

四、拷贝zoo_samle.cfg为zoo.cfg

cp zoo_sample.cfg zoo.cfg 

  

五、编辑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=/usr/local/zookeeper
dataLogDir=/usr/local/zookeeper/log
# the port at which the clients will connect
clientPort=2181
server.1=192.168.32.129:2888:3888

  

六、设置环境变量

[root@localhost conf]# export ZOOKEEPER_INSTALL=/opt/deploy/zookeeper-3.3.6  
[root@localhost conf]# export PATH=$PATH:$ZOOKEEPER_INSTALL/bin 

  

七、启动

[root@localhost bin]# ./zkServer.sh start

  

八、测试zookeeper

[root@localhost bin]# ./zkCli.sh -server 192.168.147.128:2181

  

注意:如果出现拒绝连接,请检查如下:

1、防火墙是否关闭  systemctl stop firewalld

原文地址:https://www.cnblogs.com/yui66/p/10282790.html