Database Reference
In-Depth Information
The native ZooKeeper monitoring keywords—colloquially known as the
“four-letter words”—are a series of commands that return state information
about the ZooKeeper cluster. As the nickname suggests, all of these
commands consist of four letters: dump , envi , reqs , ruok , srst , and
stat . The commands themselves are transmitted in the clear to ZooKeeper
on its client port, returning plaintext output. For example, to send the ruok
command from a shell command, simply use echo and the netcat utility:
echo ruok | nc 127.0.0.1 2181
If the ZooKeeper server is operating normally, the server returns an imok
response. If the server is in a bad state it does not send a response at all. By
sending this command periodically, monitoring software can ensure that all
nodes are up and running.
The dump command returns data about currently connected sessions and
ephemeral nodes being held by those sessions. It must be run against the
current Leader of the ZooKeeper cluster. In this particular example, the
distributed queue producer example found later in this chapter is running
and the command returns the following information:
$ echo dump | nc 127.0.0.1 2181
SessionTracker dump:
Session Sets (2):
0 expire at Wed Jan 15 22:13:03 PST 2014:
1 expire at Wed Jan 15 22:13:06 PST 2014:
0x143999dfb5c0004
ephemeral nodes dump:
Sessions with Ephemerals (0):
Inthiscase,therearenoephemeralnodesbeingused,andtwosessionshave
been opened.
The envi command dumps information from the server's environment
variables.Forexample,thisZooKeeperinstanceisincludedwithKafka2.8.0
(covered in Chapter 4) and is running under Oracle Java 7 on OS X:
$ echo envi | nc 127.0.0.1 2181
Environment:
zookeeper.version=3.3.3-1203054, built on 11/17/2011
Search WWH ::




Custom Search