五、Linux 上安装 zookeeper

参考:
cnblogs.com/expiator/p/9853378.html
https://www.cnblogs.com/daleyzou/p/8558140.html

安装:
tar -zxvf uploadfile/zookeeper-3.4.10.tar.gz
cd zookeeper-3.4.10/conf
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
dataDir=/home/hadoop/dataDir/zookeeper
dataLogDir=/home/hadoop/dataLogDir/zookeeper
server.1=192.168.27.20:2888:3888
server.2=192.168.27.21:2888:3888
server.3=192.168.27.22:2888:3888

cd /home/hadoop/dataDir/zookeeper
vi myid
vi /etc/profile

服务端:(逐台机器执行)
启动
/home/hadoop/zookeeper-3.3.6/bin/zkServer.sh start
停止
/home/hadoop/zookeeper-3.3.6/bin/zkServer.sh stop
重启
/home/hadoop/zookeeper-3.3.6/bin/zkServer.sh restart
查看状态:
/home/hadoop/zookeeper-3.3.6/bin/zkServer.sh status
客户端:
在zookeeper中任意一个节点,执行指令:
/home/hadoop/zookeeper-3.3.6/bin/zkCli.sh
查看帮助信息:zkCli.sh help

异常:
zookeeper的出错日志会记录在 zookeeper.out。
当前处于哪个目录,执行完zkServer.sh start命令, zookeeper.out就会写在哪个目录。

异常一:
启动zookeeper集群, WARN [QuorumPeer:/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@384] - Cannot open channel to 3 at election address /192.168.27.22:3888
java.net.NoRouteToHostException: 没有到主机的路由
解决办法:
centos7关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state ##查看防火墙状态,是否是running

异常二:部分主机启动失败
解决:启动集群时,注意linux登录用户是否改变,避免部分自建目录因权限导致访问失败。

你可能感兴趣的:(五、Linux 上安装 zookeeper)