在我的HDP集群中,我在3个节点(master1,master2,master3)上安装了3个zookeeper服务器和zookeeper客户端。
所有节点都在Redhat 7.2版上
当我们在master1上的zookeeper服务器上从master1运行zookeeper-client时,我们得到 CONNECTING
当我们在master2上的zookeeper服务器上从master1运行zookeeper-client时,我们得到 CONNECTED
当我们在master3上的zookeeper服务器上从master1运行zookeeper-client时,我们得到 CONNECTED
[root@master1 ~]# /usr/hdp/current/zookeeper-client/bin/zookeeper-client -server master1:2181
Connecting to master1:2181
Welcome to ZooKeeper!
JLine support is enabled
[zk: master1:2181(CONNECTING) 0] <-- we get CONNECTING instead to get CONNECTED
[root@master1 ~]# /usr/hdp/current/zookeeper-client/bin/zookeeper-client -server master2:2181
Connecting to master2:2181
Welcome to ZooKeeper!
JLine support is enabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: master2:2181(CONNECTED) 0]
[root@master1 ~]# /usr/hdp/current/zookeeper-client/bin/zookeeper-client -server master3:2181
Connecting to master3:2181
Welcome to ZooKeeper!
JLine support is enabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: master3:2181(CONNECTED) 0]
所以问题仅在master1机器上,并且实际上客户端无法连接到机器-master1上的zookeeper服务器
这可能是什么原因?
这是master1机器上的zoo.cfg
more /etc/zookeeper/2.6.4.0-91/0/zoo.cfg
clientPort=2181
syncLimit=15
autopurge.purgeInterval=24
maxClientCnxns=60
dataDir=/var/hadoop/zookeeper
initLimit=30
tickTime=2000
autopurge.snapRetainCount=30
server.1=master1.sys89.com:2888:3888
server.2=master2.sys89.com:2888:3888
server.3=master3.sys89.com:2888:3888
这是master1机器上的zookeeper-client
cat /usr/hdp/current/zookeeper-client/bin/zookeeper-client
#!/bin/bash
export ZOOKEEPER_HOME=/usr/hdp/2.6.4.0-91//zookeeper
export ZOOKEEPER_CONF=${ZOOKEEPER_HOME}/conf
export CLASSPATH=$CLASSPATH:$ZOOKEEPER_CONF:$ZOOKEEPER_HOME/*:$ZOOKEEPER_HOME/lib/*
export ZOOCFGDIR=${ZOOCFGDIR:-$ZOOKEEPER_CONF}
env CLASSPATH=$CLASSPATH ${ZOOKEEPER_HOME}/bin/zkCli.sh "$@"
我们检查端口2181并获得正常状态
telnet localhost 2181
Trying ::1
Connected to localhost.
Escape character is '^]'.