快速查看zookeeper相关信息(Server status 、Client connections、Watches 、Monitoring )之4-字符命令

如果读者还没有zookeeper集群环境,可以参考笔者之前的博客,如下:

《Centos7在VMware12中克隆多个节点》

《快速搭建zookeeper集群环境》

《zookeeper集群环境配置说明及命令行增删改查操作znode》

在获取zookeeper相关信息时,以下4-字符命令比较方便。

1.命令列表

Category

Command

Description

Server
status

ruok

P straintets. imok if the server is running and not in an error

 

conf

Prints the server configuration (from zoo.cfg).

 

envi

Prints the server environment, including ZooKeeper
version, Java version, and other system properties.

 

srvr

Prints server statistics, including latency statistics, the
number of znodes, and the server mode (standalone,
leader, or follower).

 

stat

Prints server statistics and connected clients.

 

srst

Resets server statistics.

 

isro

Shows whether the server is in read-only (ro) mode (due
to a network partition) or read/write mode (rw).

Client
connections

dump

Lists all the sessions and ephemeral znodes for the
ensemble. You must connect to the leader (see srvr) for
this command.

 

cons

Lists connection statistics for all the server’s clients.

 

crst

Resets connection statistics.

Watches

wchs

Lists summary information for the server’s watches.

 

wchc

Lists all the server’s watches by connection. Caution:
may impact server performance for a large number of
watches.

 

wchp

Lists all the server’s watches by znode path. Caution:
may impact server performance for a large number of
watches.

Monitoring

mntr

Lists server statistics in Java properties format, suitable
as a source for monitoring systems such as Ganglia and
Nagios.

2.命令使用

使用方法如下:

例如:查看sever是否正常:ruok

echo ruok | nc localhost 2181

如果正常则打印出 imok


猜你喜欢

转载自blog.csdn.net/lyitit/article/details/80853607
今日推荐