首页  

zookeeper常用运维命令     所属分类 zookeeper 浏览量 1428
telnet 输入4字命令
./zkServer.sh status


1 详细配置信息

echo conf|nc localhost 2181

clientPort=2181
dataDir=/home/dyyx/softwares/zookeeper-3.4.8/data/version-2
dataLogDir=/home/dyyx/softwares/zookeeper-3.4.8/logs/version-2
tickTime=2000
maxClientCnxns=60
minSessionTimeout=4000
maxSessionTimeout=40000
serverId=0

2 输出指定server上所有的客户端连接信息,包括IP,会话ID等

echo cons|nc localhost 2182


 /10.57.31.24:57820[1](queued=0,recved=78279,sent=78281,sid=0x16938dcb5520001,lop=PING,est=1551695411639,to=6000,lcxid=0x3d,lzxid=0xe5,lresp=1551852154965,llat=0,minlat=0,avglat=0,maxlat=2)
 /10.57.240.71:59399[0](queued=0,recved=1,sent=0)
 /10.57.31.22:46444[1](queued=0,recved=623,sent=623,sid=0x16938dcb5520007,lop=PING,est=1551845093460,to=40000,lcxid=0x5e,lzxid=0xe5,lresp=1551852144346,llat=0,minlat=0,avglat=0,maxlat=1)
 /10.57.31.22:46464[1](queued=0,recved=548,sent=548,sid=0x16938dcb5520008,lop=PING,est=1551845108038,to=40000,lcxid=0x13,lzxid=0xe5,lresp=1551852154086,llat=0,minlat=0,avglat=0,maxlat=1)




连接信息总览, 连接IP,端口号,该连接的发包数、该连接的sessionid,
最后操作方式/命令、连接的时间戳、超时时间(未确认),最后的zxid,最后的响应时间戳、连接的时间延时信息等

3 重置所有的连接信息统计

echo crst|nc localhost 2181


4 列出所有等待队列中的会话和临时节点信息,针对leader

echo dump|nc localhost 2182


5 状态和连接的客户端信息

echo stat|nc localhost 2181

Zookeeper version: 3.4.8--1, built on 02/06/2016 03:18 GMT
Clients:
 /10.57.240.71:59076[0](queued=0,recved=1,sent=0)
 /10.57.31.24:57820[1](queued=0,recved=78214,sent=78216)
 /10.57.31.22:46444[1](queued=0,recved=614,sent=614)
 /10.57.31.22:46464[1](queued=0,recved=538,sent=538)

Latency min/avg/max: 0/0/56
Received: 79634
Sent: 79635
Connections: 4
Outstanding: 0
Zxid: 0xe5
Mode: standalone
Node count: 62


6 列出所有的watcher信息 
  watcher session  path 

echo wchc|nc localhost 2181



0x16938dcb5520001
	/controller
	/isr_change_notification
	/admin/preferred_replica_election
	/admin/reassign_partitions
	/log_dir_event_notification
	/brokers/ids
	/admin/delete_topics
	/config/changes
	/brokers/topics


7 运行时信息

echo mntr|nc localhost 2181

zk_version	3.4.8--1, built on 02/06/2016 03:18 GMT
zk_avg_latency	0
zk_max_latency	56
zk_min_latency	0
zk_packets_received	79555
zk_packets_sent	79556
zk_num_alive_connections	4
zk_outstanding_requests	0
zk_server_state	standalone
zk_znode_count	62
zk_watch_count	49
zk_ephemerals_count	9
zk_approximate_data_size	6166
zk_open_file_descriptor_count	30
zk_max_file_descriptor_count	65535

版本 延时 收包 发包 连接数 未完成客户端请求数
leader/follower 状态 
znode数 watch数 临时节点数
近似数据大小  打开文件描述符数 
最大文件描述符数 fllower数等

telnet 127.0.0.1 2184
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
mntr
zk_version	3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency	0
zk_max_latency	0
zk_min_latency	0
zk_packets_received	1
zk_packets_sent	0
zk_num_alive_connections	1
zk_outstanding_requests	0
zk_server_state	leader
zk_znode_count	11
zk_watch_count	0
zk_ephemerals_count	0
zk_approximate_data_size	98
zk_open_file_descriptor_count	36
zk_max_file_descriptor_count	10240
zk_followers	1
zk_synced_followers	1
zk_pending_syncs	0
Connection closed by foreign host.



zk_server_state	leader
zk_followers	1
zk_synced_followers	1
zk_pending_syncs	0






8 环境详细信息
echo envi|nc localhost 2181

Environment:
zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
host.name=xxx
java.version=1.8.0_60
java.vendor=Oracle Corporation
java.home=/usr/install/jdk1.8.0_60/jre
java.class.path=xxx
java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.io.tmpdir=/tmp
java.compiler=
os.name=Linux
os.arch=amd64
os.version=3.10.0-693.el7.x86_64
user.name=root
user.home=/root
user.dir=/home/xxx/softwares/zookeeper-3.4.8/bin

9 列出服务器watches的简洁信息:连接总数、watching节点总数和watches总数
echo wchs|nc 10.57.31.22 2181
3 connections watching 26 paths
Total watches:26



其他四字命令

ruok  正常返回 imok,否则返回空。
srst 重置服务器的统计信息
srvr 服务器详细信息

上一篇     下一篇
spring4种注入方式

aql输出格式和TTL设置

aerospike使用truncate删除历史数据

mysql innodb 索引原理

innodb与myisam的区别

MySQL InnoDB存储结构