zookeeper 集群最好是奇数台:
5台允许挂掉2台
4台只能允许挂掉1台
zjtest7-redis:/opt/zookeeper/bin# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: follower
zjtest7-redis2:/opt/zookeeper/bin# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: leader
zjtest7-haproxy:/opt/zookeeper/bin# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: follower
zookeeper集群 没有固定的leader
create /test "testvalue" 前面目录,后面数据内容
[zk: 192.168.32.81:2181(CONNECTED) 3] get /test
testvalue
cZxid = 0x100000017
ctime = Mon Jul 18 14:14:24 CST 2016
mZxid = 0x100000017
mtime = Mon Jul 18 14:14:24 CST 2016
pZxid = 0x100000017
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 9
numChildren = 0
[zk: 192.168.32.81:2181(CONNECTED) 5] get /test
testvalue
cZxid = 0x100000017
ctime = Mon Jul 18 14:14:24 CST 2016
mZxid = 0x100000017
mtime = Mon Jul 18 14:14:24 CST 2016
pZxid = 0x100000018
cversion = 1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 9
numChildren = 1
[zk: 192.168.32.81:2181(CONNECTED) 6] get /test/child
childvalue
cZxid = 0x100000018
ctime = Mon Jul 18 14:17:17 CST 2016
mZxid = 0x100000018
mtime = Mon Jul 18 14:17:17 CST 2016
pZxid = 0x100000018
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 10