1.排查
1.启动zookeeper后查看状态/bin/zkServer.sh status
发现报错Error contacting service. It is probably not running.
[root@zookeeper01 apache-zookeeper-3.8.2-bin]# ./bin/zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.8.2-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Error contacting service. It is probably not running.
2.查看日志zookeeper-root-server-zookeeper01.out
发现报了一拒绝链接java.net.ConnectException: 拒绝连接 (Connection refused)
[root@zookeeper01 logs]# pwd
/opt/apache-zookeeper-3.8.2-bin/logs
[root@zookeeper01 logs]# ls
zookeeper-root-server-zookeeper01.out
[root@zookeeper01 logs]# vim zookeeper-root-server-zookeeper01.out
2023-09-05 01:09:12,322 [myid:] - INFO [QuorumPeer[myid=1](plain=[0:0:0:0:0:0:0:0]:2181)(secure=disabled):o.a.z.s.q.FastLeaderElection@996] - Notification time out: 400 ms
2023-09-05 01:09:12,323 [myid:] - WARN [QuorumConnectionThread-[myid=1]-2:o.a.z.s.q.QuorumCnxManager@401] - Cannot open channel to 3 at election address zookeeper03/192.168.75.132:3888
java.net.ConnectException: 拒绝连接 (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.initiateConnection(QuorumCnxManager.java:384)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$QuorumConnectionReqThread.run(QuorumCnxManager.java:458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
2.解决
方法1:
将配置文件zoo.cfg
中节点对应机器的地址改为:0.0.0.0
修改完再此启动即可解决。
注意:每台机器都要改。不能只改一个节点文章来源:https://www.toymoban.com/news/detail-742431.html
server.1=0.0.0.0:2888:3888
server.2=zookeeper02:2888:3888
server.3=zookeeper03:2888:3888
quorumListenOnAllIPs=true
方法2:
若上面方法没有成功,继续下面方法2文章来源地址https://www.toymoban.com/news/detail-742431.html
- 删除data目录下的文件
version-2
,zookeeper_server.pid
rm -rf [文件名]
[root@jhh100 data]# pwd
/opt/zookeeper/data
[root@jhh100 data]# ls
myid version-2 zookeeper_server.pid
- 查看2181线程是否在运行,在的话,杀掉。
netstat -nltp | grep 2181
kill -9 [线程号]
[root@jhh100 zookeeper]# netstat -nltp | grep 2181
tcp6 0 0 :::2181 :::* LISTEN 74180/java
[root@jhh100 zookeeper]# kill -9 74180
- 启动服务
到了这里,关于zookeeper搭建分布式集群启动失败(Error contacting service. It is probably not running.)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!