1.  现象描述

1.1  查看状态

zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.5.5-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Error contacting service. It is probably not running.

Error contacting service. It is probably not running.

1.2 查看log

cat logs/zookeeper.out
WARN  [WorkerSender[myid=0]:QuorumCnxManager@677] - Cannot open channel to 1 at election address /192.168.17.22:3888
java.net.ConnectException: 拒绝连接 (Connection refused)

WARN  [WorkerSender[myid=0]:QuorumCnxManager@677] - Cannot open channel to 1 at election address /192.168.17.22:3888
java.net.ConnectException: 拒绝连接 (Connection refused)

1.3 查看各节点进程

jps
15998 QuorumPeerMain
16126 Jps

我的问题出现在这里,只有主节点有进程QuorumPeerMain,其他节点都没

2 原因

当时同时在搞hadoop和hbase,懵逼了,以为zk也只需要启动主节点,其他节点会自动启动的。然而zk并非如此,,,so,在其他节点手动启动,问题解决

zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.5.5-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower

更多推荐