ZooKeeper 基本操作

记录日期:2019年6月20日 14点26分

ZooKeeper 版本:3.5.5


参考链接:https://zookeeper.apache.org/doc/current/zookeeperStarted.html


1、连接 ZooKeeper

E:\environment\zookeeper\apache-zookeeper-3.5.5>bin\zkCli -server 127.0.0.1:2181


2、查看节点

ls /


3、创建节点

create /zk_test my_data


4、设置节点数据

set /zk_test junk


5、获取节点数据

get /zk_test


6、删除节点

delete /zk_test

如果删除的节点存在子节点,删除失败,使用以下命令。

deleteall /zk_test


7、查看节点状态

stat /zk_test


ZooKeeper 命令:

ZooKeeper -server host:port cmd args
        addauth scheme auth
        close
        config [-c] [-w] [-s]
        connect host:port
        create [-s] [-e] [-c] [-t ttl] path [data] [acl]
        delete [-v version] path
        deleteall path
        delquota [-n|-b] path
        get [-s] [-w] path
        getAcl [-s] path
        history
        listquota path
        ls [-s] [-w] [-R] path
        ls2 path [watch]
        printwatches on|off
        quit
        reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*]
        redo cmdno
        removewatches path [-c|-d|-a] [-l]
        rmr path
        set [-s] [-v version] path data
        setAcl [-s] [-v version] [-R] path acl
        setquota -n|-b val path
        stat [-w] path
        sync path

posted @ 2019-06-20 14:28  Kuningasic  阅读(1060)  评论(0编辑  收藏  举报