情况是这样的:

[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@382] - Cannot open channel to 1 at election address os1.example.com/192.168.0.110:3888
java.net.ConnectException: 拒绝连接
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:368)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:402)
at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:840)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:762)

2016-7-7 23:36:35,666 [myid:3] - INFO  [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@849] - Notification time out: 60000

我的环境是VM下3个centos7虚拟机桥接网络,zookeeper三个都启动了还算拒绝连接

hosts与hostname都配置好了,并且可以相互ping通

确定防火墙已经关闭

关闭的命令:

systemctl status firewalld.service  #检查防火墙状态

systemctl stop firewalld.service  #关闭防火墙

systemctl disable firewalld.service  #禁止开机启动防火墙

关闭SELINUX

vim /etc/selinux/config

#SELINUX=enforcing  #注释掉

#SELINUXTYPE=targeted  #注释掉

SELINUX=disabled  #增加


三台机器在这种情况下,还是互相拒绝连接,后来通过百度,终于找到如下的链接(原谅我吧,大部分的内容都是照它写的,不过情况确实是一样的)

http://www.oschina.net/question/914277_2139350?fromerr=U9hFdhpN

这个发帖的人询问了大神以后,通过如下的办法解决了问题:

将所有机器的/etc/hosts中的127.0.1.1这一行去掉


我照着试了下,果然有效!!!







Logo

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

更多推荐