【Zookeeper】常用监控“四字命令”

Four-Letter Words

Now that we have our server configured and up and running, we need to monitor it.
That is where four-letter words come in. We have already seen some examples of fourletter words when we used telnet to see the system status Four-letter words provide a simple way to do various checks on
the system. The main goal with four-letter words is to provide a very simple protocol
that can be used with simple tools, such as telnet and nc, to check system health and
diagnose problems. To keep things simple, the output of a four-letter word will be human

readable. This makes the words easy to experiment with and use.

ruok

Provides (limited) information about the status of the server. If the server is run‐
ning, it will respond with imok. It turns out that “OK” is a relative concept, though.
For example, the server might be running but unable to communicate with the other
servers in the ensemble, yet still report that it is “OK.” For a more detailed and
reliable health check, use the stat word.


stat

Provides information about the status of the server and the connections that are
currently active. The status includes some basic statistics and whether the server is
currently active, if it is a leader or follower, and the last zxid the server has seen.
Some of the statistics are cumulative and can be reset using the srst word.

【Zookeeper】常用监控“四字命令”_第1张图片

srvr

Provides the same information as stat, except the connection information, which
it omits.

【Zookeeper】常用监控“四字命令”_第2张图片

dump

Provides session information, listing the currently active sessions and when they
will expire. This word can be used only on a server that is acting as the leader.

conf

Lists the basic server configuration parameters that the server was started with.

envi

Lists various Java environment parameters.

mntr

Offers more detailed statistics than stat about the server. Each line of output has
the format keyvalue. (The leader will list some additional parameters that
apply only to leaders.)

wchs

Lists a brief summary of the watches tracked by the server.

wchc

Lists detailed information on the watches tracked by the server, grouped by session.

wchp

Lists detailed information on the watches tracked by the server, grouped by the
znode path being watched.

cons, crst

cons lists detailed statistics for each connection on a server and crst resets all the
connection counters to zero.(((“cons”))


命令格式:

echo 四字命令 | nc zkIP zkPort

例子:

echo conf | nc 127.0.0.1 2181

你可能感兴趣的:(zookeeper,zookeeper)