通过zkServer.sh status查看zookeeper的状态的时候出现如下的错误提示:
[root@soft ~]# zkServer.sh status
JMX enabled by default
Using config: /usr/sbin/../etc/zookeeper/zoo.cfg
Error contacting service. It is probably not running.
停掉ZK,然后以start-foreground方式启动,查看启动日志:
即:zkServer.sh start-foreground
2016 -12 -29 11 :56 :46 ,706 [myid:1 ] - WARN [QuorumPeer[myid=1 ]/0 :0 :0 :0 :0 :0 :0 :0 :2181 :Learner@232 ] - Unexpected exception , tries=0 , connecting to zk3/好host2:2888
java.net.NoRouteToHostException: No route to host
发现是host2的2888端口不通,于是将ZK相关节点的防火墙上开启2888端口,再次启动zkServer.sh start,节点状态正常了。
[root@soft ~]
JMX enabled by default
Using config : /usr/sbin/ ../etc/zookeeper/zoo.cfg
Mode : follower