Python 操作zookeeper

 

 

from kazoo.client import KazooClient

# https://www.cnblogs.com/sanduzxcvbnm/p/11579380.html
zk = KazooClient(hosts='192.168.128.130:2181', timeout=10)
zk.start()
# zk.create('/abc/JQK/XYZ/0001', b'this is my house', makepath=True)

node = zk.get_children('/')  # 查看根节点有多少个子节点
print(node)
zk.stop()  # 与zookeeper断

 

posted @ 2020-03-05 17:31  whitesky-root  阅读(28)  评论(0编辑  收藏