zookeeper常用命令

bin/zkServer.sh start   //启动服务

bin/zkServer.sh stop

 

bin/zkCli.sh -server 127.0.0.1:2181   //客户端连接

 

delete /dubbo  //删除指定节点,只能删除非空节点

rmr /dubbo    //删除dubbo节点及子节点

 

ls /      //使用ls查看当前zookeeper中所包含的内容

ls2 /     //查看当前节点数据并能看到更新次数等数据

 

echo stat|nc 127.0.0.1 2181   //查看哪个节点被选择作为follower或者leader

echo dump| nc 127.0.0.1 2181  //列出未经处理的会话和临时节点

echo conf | nc 127.0.0.1 2181  //输出相关服务配置的详细信息

 

[root@iZ25se753clZ bin]# echo conf | nc 127.0.0.1 2181

clientPort=2181

dataDir=/home/ywl/zookeeper-3.4.6/data/version-2

dataLogDir=/home/ywl/zookeeper-3.4.6/data/version-2

tickTime=2000

maxClientCnxns=60

minSessionTimeout=4000

maxSessionTimeout=40000

serverId=0

 

echo cons | nc 127.0.0.1 2181   //列出所有连接到服务器的客户端的完全的连接 / 会话的详细信息。

 

[root@iZ25se753clZ bin]# echo envi |nc 127.0.0.1 2181

Environment:

zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT

host.name=iZ25se753clZ

java.version=1.7.0_51

java.vendor=Oracle Corporation

java.home=/usr/jdk1.7.0_51/jre

java.class.path=/home/ywl/zookeeper-3.4.6/bin/../build/classes:/home/ywl/zookeeper-3.4.6/bin/../build/lib/*.jar:/home/ywl/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/ywl/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/home/ywl/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/home/ywl/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/home/ywl/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/home/ywl/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/home/ywl/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/home/ywl/zookeeper-3.4.6/bin/../conf:.:/usr/jdk1.7.0_51//lib/dt.jar:/usr/jdk1.7.0_51//lib/tools.jar

java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

java.io.tmpdir=/tmp

java.compiler=<NA>

os.name=Linux

os.arch=amd64

os.version=2.6.32-431.23.3.el6.x86_64

user.name=root

user.home=/root

user.dir=/home/ywl/zookeeper-3.4.6/bin

 

参考信息:  http://blog.csdn.net/xiaolang85/article/details/13021339

你可能感兴趣的:(zookeeper)