# Zookeeper Four Letter Words commands

In 
Published 2022-12-03

This tutorial explains to you Zookeeper Four Letter Words commands. In this article you can see how to enable Four Letter Words commands in Kafka.

ZooKeeper responds to a small set of commands. Each command is composed of 4 letters. You issue the commands to ZooKeeper via telnet or nc at the client port.

By default, 4-letter-word commands are disabled—you must enable them when configuring the ZooKeeper.

Example lines you can add to the zookeeper.properties file:

// Enable all 4lw commands
4lw.commands.whitelist=*

OR

// Enable only ruok, stat, conf, isro
4lw.commands.whitelist=stat, ruok, conf, isro

The following 4-letter-word commands are supported:

  • ruok - Tests if server is running in a non-error state. The server will respond with imok if it is running. Otherwise, it will not respond at all. A response of "imok" does not necessarily indicate that the server has joined the quorum, just that the server process is active and bound to the specified client port. Use "stat" for details on state wrt quorum and client connection information.

Example:

  • srst - Reset server statistics.

  • stat - Lists brief details for the server and connected clients.

  • dump - Lists the outstanding sessions and ephemeral nodes. This only works on the leader.

  • envi - Print details about serving environment.

Example:

  • srvr (New in 3.3.0) - Lists full details for the server.

Example:

  • wchs (New in 3.3.0) - Lists brief information on watches for the server.

  • wchp (New in 3.3.0) - Lists detailed information on watches for the server, by path. This outputs a list of paths (znodes) with associated sessions. Note, depending on the number of watches this operation may be expensive (ie impact server performance), use it carefully.

Example:

  • wchc (New in 3.3.0) - Lists detailed information on watches for the server, by session. This outputs a list of sessions (connections) with associated watches (paths). Note, depending on the number of watches this operation may be expensive (ie impact server performance), use it carefully.

Example:

  • conf (New in 3.3.0) - Print details about serving configuration.

Example:

  • cons (New in 3.3.0) - List full connection/session details for all clients connected to this server. Includes information on numbers of packets received/sent, session id, operation latencies, last operation performed, etc...

  • crst (New in 3.3.0) - Reset connection/session statistics for all connections.

  • mntr (New in 3.4.0) - Outputs a list of variables that could be used for monitoring the health of the cluster.

Example:

  • dirs (New in 3.5.1) - Shows the total size of snapshot and log files in bytes.