错误:

zookeeper报错:[WorkerSender[myid=2]:QuorumCnxManager@584] - Cannot open channel to 3 at election address /192.168.211.140:3888

操作:

zookeeper安装完成之后,启动之后正常,出现 Error contacting service. It is probably not running.
之后查看zookeeper.out文件时发现错误。

报错日志:

在这里插入图片描述

)
2020-06-18 11:38:20,440 [myid:2] - WARN  [WorkerSender[myid=2]:QuorumCnxManager@584] - Cannot open channel to 3 at election address /192.168.211.140: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.connectOne(QuorumCnxManager.java:558)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:534)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:454)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:435)
        at java.lang.Thread.run(Thread.java:748)

报错原因:

查看了网上许多文章之后发现,如果是刚启动zookeeper报出这个错误,然后不再不错,那就是正常现象。原因是有的节点启动,而有的节点还没有启动,这段时间已经启动的节点就会去连接没有启动的节点但是连接不上,就会报出这样的错误。

解决:

如果所有节点的zookeeper都启动了,还是报错,可以修改每个节点的zoo.cfg文件中
对应的server.x=0.0.0.0:2888:3888解决:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
重启zookeeper,问题解决

./zkServer.sh restart
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐