服務器信息node
zookeeper版本 3.4.6服務器
jdk版本 1.7.0_80app
10.100.0.29 zk1 10.100.0.44 zk2 10.100.0.45 zk3 10.100.0.46 zk4 10.100.0.47 zk5
##zookeeper擴容(3 -> 5)測試
配置:ui
tickTime=2000 initLimit=10 syncLimit=5 dataDir=/data/app/zookeeper clientPort=2181 server.1=10.100.0.29:2888:3888 server.2=10.100.0.44:2888:3888 server.3=10.100.0.45:2888:3888
zk1狀態:code
Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT Clients: /127.0.0.1:36078[0](queued=0,recved=1,sent=0) Latency min/avg/max: 0/0/0 Received: 1 Sent: 0 Connections: 1 Outstanding: 0 Zxid: 0x0 Mode: follower Node count: 4
zk2狀態:server
Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT Clients: /127.0.0.1:46938[0](queued=0,recved=1,sent=0) Latency min/avg/max: 0/0/0 Received: 1 Sent: 0 Connections: 1 Outstanding: 0 Zxid: 0x100000000 Mode: leader Node count: 4
zk3狀態:get
Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT Clients: /127.0.0.1:37306[0](queued=0,recved=1,sent=0) Latency min/avg/max: 0/0/0 Received: 1 Sent: 0 Connections: 1 Outstanding: 0 Zxid: 0x100000000 Mode: follower Node count: 4
建立znode查看集羣是否同步同步
2.加入zookeeper 4,5節點it
配置以下:
tickTime=2000 initLimit=10 syncLimit=5 dataDir=/data/app/zookeeper clientPort=2181 server.1=10.100.0.29:2888:3888 server.2=10.100.0.44:2888:3888 server.3=10.100.0.45:2888:3888 server.4=10.100.0.46:2888:3888 server.5=10.100.0.47:2888:3888
zk4:
[zk: localhost:2181(CONNECTED) 0] get /test/test1 "test1" cZxid = 0x10000000a ctime = Sun Jun 05 08:51:09 CST 2016 mZxid = 0x10000000a mtime = Sun Jun 05 08:51:09 CST 2016 pZxid = 0x10000000a cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 7 numChildren = 0 [zk: localhost:2181(CONNECTED) 1] create /test/test2 'test2' Created /test/test2
zk1:
[zk: localhost:2181(CONNECTED) 0] get /test/test2 'test2' cZxid = 0x100000015 ctime = Sun Jun 05 08:58:24 CST 2016 mZxid = 0x100000015 mtime = Sun Jun 05 08:58:24 CST 2016 pZxid = 0x100000015 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 7 numChildren = 0
##集羣收縮(5-3)
修改保留節點的配置後依次重啓,重啓完成後依次關閉2個不須要的節點便可。