简体   繁体   English

Zookeeper连接异常,连接被拒绝

[英]Zookeeper connection exception, connection refused

 ERROR NetworkManager client connect error
java.net.ConnectException: Connection refused
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:458)
        at sun.nio.ch.Net.connect(Net.java:450)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
        at ch.usi.da.paxos.ring.NetworkManager.connectClient(NetworkManager.java         :295)
        at ch.usi.da.paxos.ring.RingManager.notifyRingChanged(RingManager.java:115)
        at ch.usi.da.paxos.ring.RingManager.process(RingManager.java:189)
        at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.j         ava:522)
        at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)

Is the error I receive when calling Zookeeper from a Java client. 是从Java客户端调用Zookeeper时收到的错误。

My zookeeper configuration is 我的Zookeeper配置是

tickTime=2000
dataDir=/var/lib/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.1=192.168.1.200:2888:3888                                
server.2=192.168.1.201:2888:3888
server.3=192.168.1.202:2888:3888

I'm running the programm on Linux, on windows with a single zookeeper instance everything worked excellent. 我在Linux上运行该程序,在具有单个zookeeper实例的Windows上,一切运行正常。 It seems like Zookeeper client connected to a different subnet than the server. Zookeeper客户端似乎连接到与服务器不同的子网。

Problem resolved. 问题已解决。 The client first chose the ipv6 interface, while the server was configured for ipv4. 客户端首先选择了ipv6接口,而服务器已配置为ipv4。 After that the Client chose the global Ip of the computer, while the server was configured for the local ip. 此后,客户端选择了计算机的全局IP,而服务器已配置为本地IP。

Disabling ipv6 on the cluster and configuring the server to the global ip did the trick. 在群集上禁用ipv6并将服务器配置为全局ip可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM