1 2 3 | wget http://www.bizdirusa.com/mirrors/apache/ZooKeeper/stable/zookeeper3.4.5. tar.gz tar xzvf zookeeper3.4.5.tar.gz |
1 2 3 4 5 6 | tickTime=2000 dataDir=/var/lib/zookeeper clientPort=2181 initLimit=5 syncLimit=2 server.1=zkserver1.mybiz.com:2888:3888 server.2=zkserver2.mybiz.com:2888:3888 server.3=zkserver3.mybiz.com:2888:3888 |
1 2 | mark@zkserver1.mybiz.com:~# cat /var/lib/zookeeper/myid 1 |
1 2 | zookeeper3.4.5/ bin/zkServer.sh start |
1 2 | zookeeper3.4.5/ bin/zkCli.sh server zkserver1.mybiz.com:2181,zkserver2.mybiz.com:2181,zkserver3.mybiz.com:2181 |
1 2 | [zk:127.0.0.1:2181(CONNECTED) 2] create /mynode helloworld Created /mynode |
1 2 3 4 5 6 7 | [zk:127.0.0.1:2181(CONNECTED) 6] get /mynode helloworld cZxid = 0x200000005 ctime = Sat Jul 20 19:53:52 PDT 2013 mZxid = 0x200000005 mtime = Sat Jul 20 19:53:52 PDT 2013 pZxid = 0x200000005 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 11 numChildren = 0 |
1 2 | [zk:127.0.0.1:2181(CONNECTED) 7] rmr /mynode |
1 2 | [zk:127.0.0.1:2181(CONNECTED) 10] create /mysecondnode hello Created /mysecondnode |
1 2 3 4 5 6 7 | [zk:127.0.0.1:2181(CONNECTED) 12] get /mysecondnode 1 hello cZxid = 0x200000007 ctime = Sat Jul 20 19:58:27 PDT 2013 mZxid = 0x200000007 mtime = Sat Jul 20 19:58:27 PDT 2013 pZxid = 0x200000007 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 5 numChildren = 0 |
1 2 3 4 5 6 7 | [zk: localhost:2181(CONNECTED) 1] set /mysecondnode hello2 cZxid = 0x200000007 ctime = Sat Jul 20 19:58:27 PDT 2013 mZxid = 0x200000009 mtime = Sat Jul 20 20:02:37 PDT 2013 pZxid = 0x200000007 cversion = 0 dataVersion = 1 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 6 numChildren = 0 |
1 2 3 | [zk:127.0.0.1:2181(CONNECTED) 13] WATCHER:: WatchedEvent state:SyncConnected type:NodeDataChanged path:/mysecondnode |
1 2 3 | [zk: localhost:2181(CONNECTED) 2] create /mysecondnode/ subnode 123 Created /mysecondnode/ subnode |
1 2 3 4 5 6 7 | [zk:127.0.0.1:2181(CONNECTED) 14] stat /mysecondnode cZxid = 0x200000007 ctime = Sat Jul 20 19:58:27 PDT 2013 mZxid = 0x200000009 mtime = Sat Jul 20 20:02:37 PDT 2013 pZxid = 0x20000000a cversion = 1 dataVersion = 1 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 6 numChildren = 1 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |