文章目录
1.排查
1.启动zookeeper后查看状态/bin/zkServer.sh status
发现报错Error contacting service. It is probably not running.
bash
[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)
bash
[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
bash
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.解决
将配置文件zoo.cfg
中节点对应机器的地址改为:0.0.0.0
修改完再此启动即可解决。
注意:每台机器都要改。不能只改一个节点
bash
server.1=0.0.0.0:2888:3888
server.2=zookeeper02:2888:3888
server.3=zookeeper03:2888:3888
quorumListenOnAllIPs=true