古人已用三冬足,年少今开万卷余。这篇文章主要讲述kafka 中zookeeper报错 cant open channel to 2 at election address相关的知识,希望能为你提供帮助。
kafka启动Zookeeper报错如下:
[2021-12-01 20:12:35,971] WARN Cannot open channel to 2 at election address /0.0.0.0:3888 (org.apache.zookeeper.server.quorum.QuorumCnxManager)
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:204)
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$
解决方法:
在每台机器自身ip监听:
server.1=10.20.20.10:2888:3888
server.2=10.20.20.11:2888:3888
server.3=0.0.0.0:2888:3888
修改后,仍会有类似报错:
[2021-12-01 20:35:04,726] WARN Cannot open channel to 1 at election address /10.20.20.10:3888 (org.apache.zookeeper.server.quorum.QuorumCnxManager)
java.net.ConnectException: Connection refused (Connection refused)
【kafka 中zookeeper报错 cant open channel to 2 at election address】??https://stackoverflow.com/questions/30940981/zookeeper-error-cannot-open-channel-to-x-at-election-address#??
解决如下,要细心不可马虎。引自stackoverflow:
I met the save question and solved it.
make sure the myid is the save with your configuration in the zoo.cfg.
please check your zoo.cfg file in your conf directory, which contains such content.
server.1=zookeeper1:2888:3888
server.2=zookeeper2:2888:3888
server.3=zookeeper3:2888:3888
and check the myid in your server dataDir directory. For example:
lets say the dataDir defined on the zoo.cfg is /home/admin/data
then on zookeeper1, you must have a file named myid and have value 1 on this file ; on zookeeper2, you must have a file named myid and have value 2 on this file; on zookeeper3, you must have a file named myid and have value 3 on this file.
if not configured like this, the server will listen on a wrong ip:port.
最终完美解决
推荐阅读
- 远程访问及控制
- Gitlab备份恢复
- 网络
- 手把手教你从零开始搭建个人博客,20 分钟上手
- 如何全局使用wp_localize_script()Ajax URL
- 如何从select标记中获取选定选项的值并在WP_query中使用它来过滤帖子()
- 如何从get_categories对象中获取ID
- 如何在WordPress中获取特定域的iframe网址
- 如何基于子域url进行get_template_part()()