info
-
centralize servie
-
maintaining configuration infomation
-
naming
-
providing distributed synchronization
-
providing group servies
-
-
znode container for
-
data
-
other nodes
-
setup a 3 node cluster
-
setup and config
-
on host1
$ sudo mv zookeeper-3.5.0-alpha/ /usr/local/zookeeper $ mkdir /usr/local/zookeeper/data $ chown -R host1 /usr/local/zookeeper $ export PATH=$PATH:/usr/local/zookeeper/bin $ pico /usr/local/zookeeper/conf/zoo.cfg tickTime=2000 initLimit=10 syncLimit=5 dataDir=/usr/local/zookeeper/data clientPort=2181 server.1=host1:20010:20011 server.2=host2:20010:20011 server.3=host2:20010:20011 $ pico /usr/local/zookeeper/data/myid 1
-
on host2
$ sudo mv zookeeper-3.5.0-alpha/ /usr/local/zookeeper $ mkdir /usr/local/zookeeper/data $ chown -R host1 /usr/local/zookeeper $ export PATH=$PATH:/usr/local/zookeeper/bin $ pico /usr/local/zookeeper/conf/zoo.cfg tickTime=2000 initLimit=10 syncLimit=5 dataDir=/usr/local/zookeeper/data clientPort=2181 server.1=host1:20010:20011 server.2=host2:20010:20011 server.3=host2:20010:20011 $ pico /usr/local/zookeeper/data/myid 2
-
on host3
$ sudo mv zookeeper-3.5.0-alpha/ /usr/local/zookeeper $ mkdir /usr/local/zookeeper/data $ chown -R host1 /usr/local/zookeeper $ export PATH=$PATH:/usr/local/zookeeper/bin $ pico /usr/local/zookeeper/conf/zoo.cfg tickTime=2000 initLimit=10 syncLimit=5 dataDir=/usr/local/zookeeper/data clientPort=2181 server.1=host1:20010:20011 server.2=host2:20010:20011 server.3=host2:20010:20011 $ pico /usr/local/zookeeper/data/myid 3
-
-
start
-
on host1
$ zkServer.sh start
-
on host2
$ zkServer.sh start
-
on host3
$ zkServer.sh start
-
-
status
-
on host1
$ zkServer.sh status
-
on host2
$ zkServer.sh status
-
on host3
$ zkServer.sh status
-
-
client demo
$ zkCli.sh -server host1:2181 [zk:...] ls [zk:...] create /my_app /somedata [zk:...] ls [zk:...] get /my_app [zk:...] ls [zk:...] set /my_app /newdata [zk:...] ls [zk:...] delete /my_app [zk:...] ls