分享

Zookeeper一直提示连接失败

Zookeeper一直提示连接失败,已经检查几遍了。还是查不出原因,请教各位大牛们? QQ截图20160324153210.png
以下是 zoo.cfg配置
dataDir=/opt/src/zookeeper-3.4.7/data
dataLogDir=/opt/src/zookeeper-3.4.7/logs
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/ ... html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=n1:2888:3888
server.2=s1:2888:3888
server.3=S2:2888:3888

已有(9)人评论

跳转到指定楼层
bioger_hit 发表于 2016-3-24 16:59:17
server.1=n1:2888:3888
server.2=s1:2888:3888
server.3=S2:2888:3888

三个会竞争端口,导致链接不上。端口可一直递增。
server.1=n1:2888:3888
server.2=s1:2889:3889
server.3=S2:2890:3890


回复

使用道具 举报

神豪。 发表于 2016-3-24 19:55:53
bioger_hit 发表于 2016-3-24 16:59
server.1=n1:2888:3888
server.2=s1:2888:3888
server.3=S2:2888:3888

您好!按你的方法改了并测试,好像还是不行.错误如下 QQ截图20160324153210.png

2016-03-24 12:17:39,696 [myid:] - INFO  [main:QuorumPeerConfig@101] - Reading configuration from: /opt/src/zookeeper-3.4.5/bin/../conf/zoo.cfg
2016-03-24 12:17:39,707 [myid:] - INFO  [main:QuorumPeerConfig@334] - Defaulting to majority quorums
2016-03-24 12:17:39,772 [myid:1] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2016-03-24 12:17:39,773 [myid:1] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2016-03-24 12:17:39,774 [myid:1] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2016-03-24 12:17:39,796 [myid:1] - INFO  [main:QuorumPeerMain@127] - Starting quorum peer
2016-03-24 12:17:39,974 [myid:1] - INFO  [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
2016-03-24 12:17:40,009 [myid:1] - INFO  [main:QuorumPeer@913] - tickTime set to 2000
2016-03-24 12:17:40,009 [myid:1] - INFO  [main:QuorumPeer@933] - minSessionTimeout set to -1
2016-03-24 12:17:40,010 [myid:1] - INFO  [main:QuorumPeer@944] - maxSessionTimeout set to -1
2016-03-24 12:17:40,010 [myid:1] - INFO  [main:QuorumPeer@959] - initLimit set to 10
2016-03-24 12:17:40,035 [myid:1] - INFO  [main:QuorumPeer@429] - currentEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation
2016-03-24 12:17:40,079 [myid:1] - INFO  [main:QuorumPeer@444] - acceptedEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation
2016-03-24 12:17:40,091 [myid:1] - INFO  [Thread-1:QuorumCnxManager$Listener@486] - My election bind port: 0.0.0.0/0.0.0.0:3888
2016-03-24 12:17:40,186 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@670] - LOOKING
2016-03-24 12:17:40,188 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@740] - New election. My id =  1, proposed zxid=0x0
2016-03-24 12:17:40,204 [myid:1] - INFO  [WorkerReceiver[myid=1]:FastLeaderElection@542] - Notification: 1 (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), 1 (n.sid), 0x0 (n.peerEPoch), LOOKING (my state)
2016-03-24 12:17:41,296 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /127.0.0.1:56833
2016-03-24 12:17:41,303 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@821] - Processing srvr command from /127.0.0.1:56833
2016-03-24 12:17:41,307 [myid:1] - INFO  [Thread-2:NIOServerCnxn@1001] - Closed socket connection for client /127.0.0.1:56833 (no session established for client)
2016-03-24 12:17:43,266 [myid:1] - WARN  [WorkerSender[myid=1]:QuorumCnxManager@368] - Cannot open channel to 2 at election address S1/192.168.253.132:3889
java.net.NoRouteToHostException: No route to host
        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:354)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:327)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:393)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:365)
        at java.lang.Thread.run(Thread.java:745)
2016-03-24 12:17:46,227 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@368] - Cannot open channel to 2 at election address S1/192.168.253.132:3889
java.net.NoRouteToHostException: No route to host
        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:354)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:388)
        at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:765)
        at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:716)
2016-03-24 12:17:46,243 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@774] - Notification time out: 400
2016-03-24 12:17:49,245 [myid:1] - WARN  [WorkerSender[myid=1]:QuorumCnxManager@368] - Cannot open channel to 3 at election address S2/192.168.253.133:3890
java.net.NoRouteToHostException: No route to host
        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:354)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:327)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:393)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:365)
        at java.lang.Thread.run(Thread.java:745)
2016-03-24 12:17:52,254 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@368] - Cannot open channel to 2 at election address S1/192.168.253.132:3889
java.net.NoRouteToHostException: No route to host
        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:354)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:388)
        at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:765)
        at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:716)



回复

使用道具 举报

atsky123 发表于 2016-3-24 22:27:58
神豪。 发表于 2016-3-24 19:55
您好!按你的方法改了并测试,好像还是不行.错误如下

2016-03-24 12:17:39,696 [myid:] - INFO  [main:Q ...

应该是防火墙的原因
回复

使用道具 举报

神豪。 发表于 2016-3-25 09:17:27
atsky123 发表于 2016-3-24 22:27
应该是防火墙的原因

您好!防火墙我第一时间就关闭了!以下是我配置的图片. hosts配置完以后也没有动过了
1.png
2.png
3.png
回复

使用道具 举报

atsky123 发表于 2016-3-25 10:20:44
神豪。 发表于 2016-3-25 09:17
您好!防火墙我第一时间就关闭了!以下是我配置的图片. hosts配置完以后也没有动过了

为何端口还没有改过来
回复

使用道具 举报

神豪。 发表于 2016-3-25 10:39:46
atsky123 发表于 2016-3-25 10:20
为何端口还没有改过来

上次改过来也暴错了,就还原了。大神你QQ多少细聊
回复

使用道具 举报

xuanxufeng 发表于 2016-3-25 11:11:44
楼主 不是一个错误,建议多参考几个文档。
回复

使用道具 举报

szcountryboy 发表于 2016-3-31 15:54:37
server.1=n1:2888:3888
server.2=s1:2888:3888
server.3=S2:2888:3888

三个节点应该是3台主机吧,同一台主机,就要改2888:3888这两个端口;3台主机就不需要改.
在另外两台主机上看是否能telnet n1 2888 / 3888 / 2181  ,如果telnet过不去,应该是防火墙的原因了

根据日志初步分析是端口不通,
回复

使用道具 举报

神豪。 发表于 2016-3-31 16:03:19
szcountryboy 发表于 2016-3-31 15:54
server.1=n1:2888:3888
server.2=s1:2888:3888
server.3=S2:2888:3888

搞定了。 直接用ip就ok了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条