转载:http://blog.csdn.net/lk10207160511/article/details/50526404
一、Zookeeper下载
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz
二、解压
tar -zxvf /home/lk/下载/zookeeper-3.3.6.tar.gz
三、 进入到conf目录
cd /opt/deploy/zookeeper-3.3.6/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
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/zookeeper
> dataLogDir=/usr/zookeeper/log
clientPort=2181
server.1=192.168.32.129:2888:3888
六、设置环境变量
export ZOOKEEPER_INSTALL=/opt/deploy/zookeeper-3.3.6
export PATH= PATH: ZOOKEEPER_INSTALL/bin
七、启动
[root@localhost bin]# ./zkServer.sh start
JMX enabled by default Using
config: /opt/deploy/zookeeper-3.3.6/bin/../conf/zoo.cfg Starting
zookeeper … STARTED [root@localhost bin]#
八、测试zookeeper
./zkCli.sh -server 192.168.32.129:2181
如果是本地连接,那么不需要 -server 192.168.32.129:2181,默认是本地
注意:如果出现拒绝连接,请检查如下:
1、防火墙是否关闭 systemctl stop firewalld
2、需要将192.168.32.129 映射到本地 /etc/hosts文件中,否则无法连接