由於服務很多都是python寫的,這裡需要安裝python用戶端,所以記錄下安裝過程
1.由於python用戶端依賴c的用戶端所以要先安裝c版本的用戶端
cd zookeeper-3.4.5/src/c./configuremake make install
2.測試c版本用戶端
./cli_mt localhost:2181Watcher SESSION_EVENT state = CONNECTED_STATEGot a new session id: 0x23f9d77d3fe0001
3.可以執行以下命令進行測試
Here's a list of command supported by the cli shell:ls <path> -- list children of a znode identified by <path>. The command set a children watch on the znode.get <path> -- get the value of a znode at <path>set <path> <value> -- set the value of a znode at <path> to <value>create [+e|+s] <path> -- create a znode as a child of znode <path>; use +e option to create an ephemeral znode, use +s option to create a znode with a sequence number appended to the name. The operation will fail if the parent znode (the one identified by <path>) doesn't exist.delete <path> -- delete the znode at <path>. The command will fail if the znode has children.sync <path> -- make sure all pending updates have been applied to znode at <path>exists <path> -- returns a result code indicating whether the znode at <path> exists. The command also sets a znode watch.myid -- prints out the current zookeeper session id.quit -- exit the shell.
4.看到以上資訊說明c版本的用戶端已經安裝好了,下面安裝python版本用戶端
5.下載python擴充包,並且解壓:
https://pypi.python.org/pypi/zkpython/0.4.2
6.如果找不到Pyhon.h,可能由於沒有安裝python26-devel
32位直接運行yum install python26-devel.i386
7.測試是否成功
import zookeeper