JMX enabled by default Error contacting service. It is probably not running错误解决
搭建zookeeper集群环境后,启动zookeeper[root@Node4 bin]# ./zkServer.sh start运行结果如下:JMX enabled by defaultUsing config: /usr/zoo/zookeeper-3.4.5/bin/../conf/zoo.cfgStarting zookeeper ... STARTED 显示以为启动成功,实
搭建zookeeper集群环境后,启动zookeeper
[root@Node4 bin]# ./zkServer.sh start
运行结果如下:
JMX enabled by default
Using config: /usr/zoo/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
显示以为启动成功,实则不然
[root@Node4 bin]# ./zkServer.sh stuts
结果如下:
JMX enabled by default
Using config: /usr/zoo/zookeeper-3.4.5/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
可见,zk未成功启动
./zkServer.sh start-foreground
结果如下:
JMX enabled by default
Using config: /usr/zoo/zookeeper-3.4.5/bin/../conf/zoo.cfg
2017-05-16 07:45:29,742 [myid:] - INFO [main:QuorumPeerConfig@101] - Reading configuration from: /usr/zoo/zookeeper-3.4.5/bin/../conf/zoo.cfg
2017-05-16 07:45:29,746 [myid:] - INFO [main:QuorumPeerConfig@334] - Defaulting to majority quorums
2017-05-16 07:45:29,764 [myid:1] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2017-05-16 07:45:29,764 [myid:1] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2017-05-16 07:45:29,764 [myid:1] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2017-05-16 07:45:29,787 [myid:1] - INFO [main:QuorumPeerMain@127] - Starting quorum peer
2017-05-16 07:45:29,802 [myid:1] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
2017-05-16 07:45:29,833 [myid:1] - INFO [main:QuorumPeer@913] - tickTime set to 2000
2017-05-16 07:45:29,833 [myid:1] - INFO [main:QuorumPeer@933] - minSessionTimeout set to -1
2017-05-16 07:45:29,833 [myid:1] - INFO [main:QuorumPeer@944] - maxSessionTimeout set to -1
2017-05-16 07:45:29,834 [myid:1] - INFO [main:QuorumPeer@959] - initLimit set to 10
2017-05-16 07:45:29,865 [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
2017-05-16 07:45:29,894 [myid:1] - INFO [Thread-1:QuorumCnxManager$Listener@486] - My election bind port: 0.0.0.0/0.0.0.0:3888
2017-05-16 07:45:29,906 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@670] - LOOKING
2017-05-16 07:45:29,908 [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
2017-05-16 07:45:29,915 [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)
2017-05-16 07:45:29,928 [myid:1] - WARN [WorkerSender[myid=1]:QuorumCnxManager@368] - Cannot open channel to 2 at election address /192.168.0.113:3888
java.net.NoRouteToHostException: 没有到主机的路由 (Host unreachable)
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: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)
2017-05-16 07:45:29,973 [myid:1] - WARN [WorkerSender[myid=1]:QuorumCnxManager@368] - Cannot open channel to 3 at election address /192.168.0.114:3888
或者使用如下命令来查看zk的启动参数:
./zkServer.sh print-cmd
更为重要的是可以通过zookeeper启动日志来查看,在/zookeeper-3.4.5/bin中
root@Node5 bin]# cat zookeeper.out
2017-05-16 07:42:10,739 [myid:] - INFO [main:QuorumPeerConfig@101] - Reading configuration from: /usr/zoo/zookeeper-3.4.5/bin/../conf/zoo.cfg
2017-05-16 07:42:10,743 [myid:] - INFO [main:QuorumPeerConfig@334] - Defaulting to majority quorums
2017-05-16 07:42:10,758 [myid:3] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2017-05-16 07:42:10,759 [myid:3] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2017-05-16 07:42:10,759 [myid:3] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2017-05-16 07:42:10,778 [myid:3] - INFO [main:QuorumPeerMain@127] - Starting quorum peer
2017-05-16 07:42:10,793 [myid:3] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
2017-05-16 07:42:10,819 [myid:3] - INFO [main:QuorumPeer@913] - tickTime set to 2000
2017-05-16 07:42:10,819 [myid:3] - INFO [main:QuorumPeer@933] - minSessionTimeout set to -1
2017-05-16 07:42:10,819 [myid:3] - INFO [main:QuorumPeer@944] - maxSessionTimeout set to -1
2017-05-16 07:42:10,819 [myid:3] - INFO [main:QuorumPeer@959] - initLimit set to 10
2017-05-16 07:42:10,842 [myid:3] - INFO [main:QuorumPeer@444] - acceptedEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation
2017-05-16 07:42:10,855 [myid:3] - INFO [Thread-1:QuorumCnxManager$Listener@486] - My election bind port: 0.0.0.0/0.0.0.0:3888
2017-05-16 07:42:10,867 [myid:3] - INFO [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:QuorumPeer@670] - LOOKING
2017-05-16 07:42:10,868 [myid:3] - INFO [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@740] - New election. My id = 3, proposed zxid=0x0
2017-05-16 07:42:10,877 [myid:3] - WARN [WorkerSender[myid=3]:QuorumCnxManager@368] - Cannot open channel to 1 at election address /192.168.0.112:3888
java.net.NoRouteToHostException: 没有到主机的路由 (Host unreachable)
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: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)
2017-05-16 07:42:11,882 [myid:3] - WARN [WorkerSender[myid=3]:QuorumCnxManager@368] - Cannot open channel to 2 at election address /192.168.0.113:3888
基于以上错误提示,定位解决方案:
1、zookeeper集群间的leader和follower互ping不同
2、防火墙是否关闭
以下针对不同版本的Linux系统检查防火墙的状态,及关闭防火墙:
---------------------------------------------------------------
Ubuntu(ubuntu-12.04-desktop-amd64)
查看防火墙状态:ufw status
关闭防火墙:ufw disable
---------------------------------------------------------------
centos6.0
查看防火墙状态:service iptables status
关闭防火墙:chkconfig iptables off #开机不启动防火墙服务
--------------------------------------------------------------
centos7.0(默认是使用firewall作为防火墙,如若未改为iptables防火墙,使用以下命令查看和关闭防火墙)
查看防火墙状态:firewall-cmd --state
关闭防火墙:systemctl stop firewalld.service
我的是centos7,却使用service iptables status等centos6的命令检查和关闭防火墙,导致防火墙实际上未关闭,故而出现以上错误
更多推荐
所有评论(0)