记一次zookeeper集群无法启动的解决(踩坑)过程

匿名 (未验证) 提交于 2019-12-03 00:37:01

今天用自己写的脚本启动zookeeper集群(用hadoop102启动自己及hadoop103,hadoop104)的时候突然报错如下:

Error contacting service. It is probably not running.

网上找了很久也没解决,查看zookeeper.out报的错误如下:

Cannot open channel to 2 at election address hadoop103/192.168.10.103:3888

java.net.ConnectException: 拒绝连接 (Connection refused)

我ssh免密登录也配了,扑所迷离的问题....

然后我查看自己写的脚本如下:

#!/bin/bash echo "-------------------正在启动zookeeper集群-------- " ssh root@hadoop102 '/opt/module/zookeeper-3.4.6/bin/zkServer.sh start' ssh root@hadoop103 '/opt/module/zookeeper-3.4.6/bin/zkServer.sh start' ssh root@hadoop104 '/opt/module/zookeeper-3.4.6/bin/zkServer.sh start' echo "-------------------查看是否启动成功及状态信息----------- " echo "---------------hadoop102查看--------" ssh root@hadoop102 'source /etc/profile;jps;/opt/module/zookeeper-3.4.6/bin/zkServer.sh status' echo "---------------hadoop103查看--------" ssh root@hadoop103 'source /etc/profile;jps;/opt/module/zookeeper-3.4.6/bin/zkServer.sh status' echo "---------------hadoop104查看--------" ssh root@hadoop104 'source /etc/profile;jps;/opt/module/zookeeper-3.4.6/bin/zkServer.sh status'

之前一直启动得好好得.....然后我尝试在启动集群的时候也增加source /etc/profile命令,改为:

#!/bin/bash echo "-------------------正在启动zookeeper集群-------- " ssh root@hadoop102 'source /etc/profile;/opt/module/zookeeper-3.4.6/bin/zkServer.sh start' ssh root@hadoop103 'source /etc/profile;/opt/module/zookeeper-3.4.6/bin/zkServer.sh start' ssh root@hadoop104 'source /etc/profile;/opt/module/zookeeper-3.4.6/bin/zkServer.sh start' echo "-------------------查看是否启动成功及状态信息----------- " echo "---------------hadoop102查看--------" ssh root@hadoop102 'source /etc/profile;jps;/opt/module/zookeeper-3.4.6/bin/zkServer.sh status' echo "---------------hadoop103查看--------" ssh root@hadoop103 'source /etc/profile;jps;/opt/module/zookeeper-3.4.6/bin/zkServer.sh status' echo "---------------hadoop104查看--------" ssh root@hadoop104 'source /etc/profile;jps;/opt/module/zookeeper-3.4.6/bin/zkServer.sh status'

.....然后奇迹般的可以正常启动了



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!