Open source softwares - Zookeeper

Back to Course

Lesson Description

Lession - #1080 Zookeeper CLI

ZooKeeper command Interface (CLI>
is used to move with the ZooKeeper ensemble for development purpose. it's useful for debugging and dealing around with totally different choices.

To perform ZooKeeper interface operations, first activate your ZooKeeper server (“bin/zkServer.sh start”>
then, ZooKeeper client (“bin/zkCli.sh”>
. Once the consumer starts, you'll be able to perform the following

  • Create znodes
  • Get data
  • Watch znode for changes
  • Set data
  • Create children of a znode
  • List children of a znode
  • Check status
  • Remove / Delete a znode

    Create znodes
    Create a znode with the given path. The flag argument specifies whether or not the created znode is going to be ephemeral (impermanent>
    , persistent, or ephemeral. By default, all znodes ar persistent.

    create /path /data

    Get data
    It returns the associated knowledge of the znode and data of the required znode. you'll get data like once the info was last changed, wherever it had been changed, and data concerning the info. This CLI is additionally wont to assign watches to point out notification concerning the data.

    get /path

    Watch znode for changes
    Watches square measure maintained locally at the ZooKeeper server to that the client is connected. this permits watches to be light-weight weight to line, maintain, and dispatch. once a shopper connects to a new server, the watch are going to be triggered for any session events. Watches won't be received whereas disconnected from a server.

    get /path [watch] 1

    Set data
    Set the information of the required znode. Once you end this set operation, you'll be able to check the data exploitation the get user interface command.

    set /path /data

    Create children of a znode
    Creating children is similar to making new znodes. the only distinction is that the path of the child znode can have the parent path likewise.


    List children of a znode
    This command is employed to list and show the children of a znode.

    ls /path

    Check status
    Status describes the information of a given znode. It contains details like Timestamp, Version number, ACL, data length, and youngsters znode.

    stat /path

    Remove / Delete a znode

    rmr /path