Java教程

JAVA之搭建zookeeper集群时候遇到的问题

本文主要是介绍JAVA之搭建zookeeper集群时候遇到的问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

问题1.如果在搭建集群时碰到类似于这样的错误, Cannot open channel to 2 at election address

WARN  [WorkerSender[myid=1]:QuorumCnxManager@584] - Cannot open channel to 2 at election address cdh03/192.168.5.148:3888
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:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    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)
                4-11 13:22:04,597 [myid:1] - INFO  [WorkerSender[myid=1]:QuorumPeer$QuorumServer@184] - Resolved hostname: cdh03 to address: cdh03/192.168.5.148
                4-11 13:22:04,598 [myid:1] - WARN  [WorkerSender[myid=1]:QuorumCnxManager@584] - Cannot open channel to 3 at election address cdh04/192.168.5.149:3888

描述:这样的问题是你在配置集群地址的时候,他无法同时启动其他服务

解决:

本机用节点 用  0.0.0.0  IP代替主机名,如

[hadoop@cdh02 ~]$ cat  /opt/software/zookeeper-3.4.13/conf/zoo.cfg
server.1=0.0.0.0:2888:3888
server.2=cdh03:2888:3888
server.3=cdh04:2888:3888

[hadoop@cdh03 ~]$ cat  /opt/software/zookeeper-3.4.13/conf/zoo.cfg
server.1=cdh02:2888:3888
server.2=0.0.0.0:2888:3888
server.3=cdh04:2888:3888


[hadoop@cdh04 ~]$ cat  /opt/software/zookeeper-3.4.13/conf/zoo.cfg
server.1=cdh02:2888:3888
server.2=cdh03:2888:3888
server.3=0.0.0.0:2888:3888

这篇关于JAVA之搭建zookeeper集群时候遇到的问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!