Connection
bin/zkCli.sh -server host:port
Connect to ZooKeeper server
bin/zkCli.sh -server localhost:2181
Connect to local ZooKeeper server on default port
Basic Commands
help
Display help information
ls /
List all ZooKeeper nodes at root
ls /brokers/ids
List Kafka broker IDs
ls /brokers/topics
List Kafka topics
get /path/to/znode
Get data from a ZNode
get /brokers/ids/[broker-id]
Get Kafka broker information
create /path data
Create a ZNode with data
set /path data
Update data in a ZNode
delete /path
Delete a ZNode
quit
Exit ZooKeeper CLI
Kafka Specific
get /controller
Get Kafka controller information
get /controller_epoch
Get controller epoch information
ls /consumers
List consumer groups (older versions)
ls /config/topics
List topics with custom configs
get /config/topics/[topic]
Get topic configuration
ls /admin/delete_topics
List topics marked for deletion
Monitoring
stat /path
Display ZNode status and metadata
mntr
Monitor ZooKeeper server statistics
conf
Show server configuration
envi
Show server environment
ruok
Test if server is running
srst
Reset server statistics
srvr
Lists server statistics
Advanced
addauth scheme auth
Add authentication
getAcl /path
Get ACL for a ZNode
setAcl /path acl
Set ACL for a ZNode
history
Show command history
redo cmdno
Redo a specific command
sync /path
Sync a ZNode with followers
listquota /path
List quota for a ZNode
setquota -n|-b val /path
Set quota for a ZNode