如何将znode添加到zookeeper并通过命令修改它?

时间:2016-06-22 08:11:40

标签: apache-zookeeper

我使用zookeeper for solrCloud。我想添加和修改Znode,所以我尝试使用下面的命令。但它没有用。有人能告诉我如何使用cmd吗?

尝试添加: try to add:

这就是结果: and this is the result:

1 个答案:

答案 0 :(得分:1)

您可能会发现此链接很有用:https://zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html

您可以通过运行以下命令来开始运行cmd: 在你的zookeeper / bin文件夹中

./zkCli.sh -server 127.0.0.1:2181

要创建znode,您必须指定路径以及与该节点关联的数据。以下是一个示例,使用命令'创建':

create [znode path] [data associated]

[zk: localhost:2181(CONNECTED) 10] ls /
[zookeeper, testing]
[zk: localhost:2181(CONNECTED) 11] create /newNode 'data_associated'
Created /newNode
[zk: localhost:2181(CONNECTED) 12] ls /
[newNode, zookeeper, testing]

您可以输入更多命令的帮助。

[zk: localhost:2181(CONNECTED) 13] help
ZooKeeper -server host:port cmd args
    stat path [watch]
    set path data [version]
    ls path [watch]
    delquota [-n|-b] path
    ls2 path [watch]
    setAcl path acl
    setquota -n|-b val path
    history
    redo cmdno
    printwatches on|off
    delete path [version]
    sync path
    listquota path
    rmr path
    get path [watch]
    create [-s] [-e] path data acl
    addauth scheme auth
    quit
    getAcl path
    close
    connect host:port