注意:如果未初始化数据目录,则无法启动ZooKeeper服务器。
//在生产环境中,您应该将ZooKeeper部署为具有奇数个服务器的集合。只要集合中的大多数服务器可用,ZooKeeper服务就可用。建议的最小集合大小是三个ZooKeeper服务器,Cloudera建议每个服务器在单独的计算机上运行。此外,如果可能,ZooKeeper服务器进程应该有自己的专用磁盘存储。
//查看zk的状态
[root@hadoop-205-107 opt]# echo "stat" |nc 192.168.205.107 2181
Zookeeper version: 3.4.5-cdh5.9.2--1, built on 04/04/2017 08:43 GMT
Clients:
/192.168.205.107:35132[1](queued=0,recved=424,sent=424)
/192.168.205.107:45317[0](queued=0,recved=1,sent=0)
/192.168.205.107:35125[1](queued=0,recved=879,sent=879)
/192.168.205.107:35227[1](queued=0,recved=6576,sent=6576)
/192.168.205.107:35133[1](queued=0,recved=449,sent=449)
/192.168.205.107:35075[1](queued=0,recved=508,sent=510)
/192.168.205.107:35100[1](queued=0,recved=432,sent=432)
/192.168.205.107:35083[1](queued=0,recved=2404,sent=2441)
Latency min/avg/max: 0/0/231
Received: 15265
Sent: 15579
Connections: 8
Outstanding: 0
Zxid: 0x7fa
Mode: standalone
Node count: 44
[root@hadoop-205-107 opt]# echo "stat" |nc 192.168.205.107 2181|grep Mode
Mode: standalone
[root@hadoop-205-107 opt]# /opt/cloudera/parcels/CDH-5.9.2-1.cdh5.9.2.p0.3/lib/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /opt/cloudera/parcels/CDH-5.9.2-1.cdh5.9.2.p0.3/lib/zookeeper/bin/../conf/zoo.cfg
Mode: standalone
[root@hadoop-205-107 opt]# telnet 192.168.205.107 2181
Trying 192.168.205.107...
Connected to 192.168.205.107.
Escape character is '^]'.
stat //手动输入
Zookeeper version: 3.4.5-cdh5.9.2--1, built on 04/04/2017 08:43 GMT
Clients:
/192.168.205.107:35132[1](queued=0,recved=445,sent=445)
/192.168.205.107:35125[1](queued=0,recved=912,sent=912)
/192.168.205.107:35227[1](queued=0,recved=7233,sent=7233)
/192.168.205.107:35133[1](queued=0,recved=470,sent=470)
/192.168.205.107:45868[0](queued=0,recved=1,sent=0)
/192.168.205.107:35075[1](queued=0,recved=529,sent=531)
/192.168.205.107:35100[1](queued=0,recved=453,sent=453)
/192.168.205.107:35083[1](queued=0,recved=2447,sent=2484)
Latency min/avg/max: 0/0/231
Received: 16267
Sent: 16595
Connections: 8
Outstanding: 0
Zxid: 0x855
Mode: standalone
Node count: 44
Connection closed by foreign host.