Zookeeper - Client (zookeeper-client)

Yarn Hortonworks

zookeeper-client

Connection

zookeeper-client -server hostname:2181
bin/zkCli.sh -server hostname:2181
# example hdinsight
/usr/hdp/current/hdinsight-zookeeper/bin/zkCli.sh --server zk0-clusterName:2181

help

Once connected

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

Example

  • Connection (You get a prompt)
zookeerper-client -server 10.0.0.8:2181
[zk: 10.0.0.8:2181(CONNECTED) 4] 

  • ls
ls /
[hiveserver2, zookeeper, yarn-leader-election, hadoop-ha, oozie, rmstore, ambari-metrics-cluster, services]

  • Get directory data
get /hiveserver2
10.40.35.149
cZxid = 0x10000014a
ctime = Thu Apr 11 13:51:37 UTC 2019
mZxid = 0x10000014a
mtime = Thu Apr 11 13:51:37 UTC 2019
pZxid = 0x10009ffd9
cversion = 6
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 12
numChildren = 2

  • ls a directory
ls /hiveserver2
[
serverUri=hn1-hddev2:10001;version=1.2.1000.2.6.5.3008-11;sequence=0000000002, 
serverUri=hn0-hddev2:10001;version=1.2.1000.2.6.5.3008-11;sequence=0000000003
]





Discover More
Yarn Hortonworks
Hadoop - Zookeeper

Zookeeper is a service used to track the health of the nodes. Zookeeper keep a quorum (logic topic on machine). ZooKeeper is a coordination service for distributed applications. It provides a shared...



Share this page:
Follow us:
Task Runner