Michael.MA
Michael.MA

Reputation: 11

How to add a znode to zookeeper and modify it by command?

I used zookeeper for solrCloud.I want to add and modify the Znode, so i try to use the commands below. But it did not work. Can someone tell me how to use the cmd?

try to add: try to add:

and this is the result: and this is the result:

Upvotes: 1

Views: 3668

Answers (1)

Michelle Tan
Michelle Tan

Reputation: 395

you may find this link useful: https://zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html

You can start the run the cmd by running the following command: In you zookeeper/bin folder

./zkCli.sh -server 127.0.0.1:2181

In order to create a znode, you have to specify a path and the data associated with the node. Here's an example, using the command 'create':

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]

And you can type in help for more commands.

[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

Upvotes: 1

Related Questions