码迷,mamicode.com
首页 > 其他好文 > 详细

ZooInspector 连接不到 Zookeeper 的解决方法

时间:2019-01-03 17:29:47      阅读:843      评论:0      收藏:0      [点我收藏+]

标签:解决   ssi   r.java   cep   leader   java.net   ...   jmx   err   

Zookeeper正常启动后,在使用 ZooInspector 连接 Zookeeper 时出现了连接不上的问题。

[root@localhost bin]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.11/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

看打印出的信息是启动成功了,但就是连接不上。

决解方法:

这时查看一下Zookeeper的启动状态或日志文件:

[root@localhost bin]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.11/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

可以看到发生了错误,并没有正常启动。

再看一下日志文件:

2017-12-13 17:56:37,514 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x100000438d60007, likely server has closed socket, closing socket connection and attempting reconnect
2017-12-13 17:56:37,668 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@190] - Failed to resolve address: slave-03
java.net.UnknownHostException: slave-03: 未知的名称或服务
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
    at java.net.InetAddress.getAllByName(InetAddress.java:1192)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)
    at java.net.InetAddress.getByName(InetAddress.java:1076)
    at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.recreateSocketAddresses(QuorumPeer.java:180)
    at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:591)
    at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:610)
    at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:845)
    at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:957)
2017-12-13 17:56:37,669 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@854] - Notification time out: 60000
2017-12-13 17:56:38,277 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1035] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)

大概猜出来了,配置文件中有错误:

[root@localhost bin]# vim ../conf/zoo.cfg 

tickTime=2000
dataDir=/usr/local/zookeeper-3.4.11/data
dataLogDir=/usr/local/zookeeper-3.4.11/log
clientPort=2181
initLimit=5
syncLimit=2
server.1=slave-01:2888:3888
server.2=slave-02:2888:3888
server.3=slave-03:2888:3888

文件中配置的是集群方式,现在是单机启动(不是单机启动不行,而是学习的过程中实验环境一直在变化)

ZooInspector 连接不到 Zookeeper 的解决方法

标签:解决   ssi   r.java   cep   leader   java.net   ...   jmx   err   

原文地址:https://www.cnblogs.com/liupeifeng3514/p/10215219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!