Zookeeper基本操作命令

执行bin目录下的zkCli.sh文件连接当前zk服务。

查看根节点下的Znode

[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]

查看zookeeper节点下的节点

[zk: localhost:2181(CONNECTED) 1] ls /zookeeper
[config, quota]

创建一个新的节点,不设置值(默认为null)

[zk: localhost:2181(CONNECTED) 2] create /zookeeper/fkk
Created /zookeeper/fkk
[zk: localhost:2181(CONNECTED) 3] ls /zookeeper
[config, fkk, quota]

设置并查看节点的值

[zk: localhost:2181(CONNECTED) 7] set /zookeeper/fkk fkkNodeVlue
[zk: localhost:2181(CONNECTED) 8] get /zookeeper/fkk
fkkNodeVlue

 删除节点

[zk: localhost:2181(CONNECTED) 9] delete /zookeeper/fkk
[zk: localhost:2181(CONNECTED) 10] ls /zookeeper
[config, quota]

 

 

 

你可能感兴趣的:(Zookeeper)