标签:zookeeper
前面已经成功部署了zookeeper quorum, 现在来试用一下。
在第四台机器上,同样下载解压zookeeper, 这次不需要部署,仅用自带的Java程序连接zookeeper服务
进入目录后执行命令连接
/zkCli.sh -server zkc:2181
help ZooKeeper -server host:port cmd args connect host:port get path [watch] ls path [watch] set path data [version] rmr path delquota [-n|-b] path quit printwatches on|off create [-s] [-e] path data acl stat path [watch] close ls2 path [watch] history listquota path setAcl path acl getAcl path sync path redo cmdno addauth scheme auth delete path [version] setquota -n|-b val path
[zk: zkc:2181(CONNECTED) 1] create /zk_test my_data create /zk_test my_data Created /zk_test [zk: zkc:2181(CONNECTED) 2] ls /zk_test ls /zk_test []
[zk: zkc:2181(CONNECTED) 3] ls / ls / [zookeeper, zk_test] [zk: zkc:2181(CONNECTED) 4] get /zk_test get /zk_test my_data cZxid = 0x100000004 ctime = Tue Mar 03 12:49:13 CST 2015 mZxid = 0x100000004 mtime = Tue Mar 03 12:49:13 CST 2015 pZxid = 0x100000004 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 7 numChildren = 0
就这么多, 具体命令参考文档:http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
编译C程序,命令很简单,进入src/c目录后:
./configure make make install
/src/c# ./cli_mt zka:2181
标签:zookeeper
原文地址:http://blog.csdn.net/csfreebird/article/details/44035049