一,查看当前zookeeper的版本
[liuhongdi@localhost ~]$ echo stat|nc 127.0.0.1 2181 Zookeeper version: 3.5.6-c11b7e26bc554b8523dc929761dd28808913f091, built on 10/08/2019 20:18 GMT
说明:架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二, 查看当前服务器上管理的Watcher的概要信息
命令: wchs
[liuhongdi@localhost ~]$ echo wchs | nc localhost 2181 1 connections watching 1 paths Total watches:1
三,查看当前服务器上管理的Watcher的详细信息:以会话为单位进行归组
[liuhongdi@localhost ~]$ echo wchc | nc localhost 2181 0x10000cf102c0000 /lockdemo
四,查看当前服务器上管理的Watcher的详细信息:节点路径为单位进行归组
[liuhongdi@localhost ~]$ echo wchp | nc localhost 2181 /lockdemo 0x10000cf102c0000
五,输出比stat命令更为详尽的服务器统计信息
[liuhongdi@localhost ~]$ echo mntr | nc localhost 2181 zk_version 3.5.6-c11b7e26bc554b8523dc929761dd28808913f091, built on 10/08/2019 20:18 GMT zk_avg_latency 0 zk_max_latency 41 zk_min_latency 0 zk_packets_received 4786 zk_packets_sent 4789 zk_num_alive_connections 2 zk_outstanding_requests 0 zk_server_state standalone zk_znode_count 7 zk_watch_count 2 zk_ephemerals_count 0 zk_approximate_data_size 82 zk_open_file_descriptor_count 47 zk_max_file_descriptor_count 4096
六,检查zookeeper服务器是否正在运行
[liuhongdi@localhost ~]$ echo ruok | nc localhost 2181 imok
七,输出zookeeper服务器的运行环境
[liuhongdi@localhost ~]$ echo envi | nc localhost 2181
说明:输出包括了java版本,linux版本,zookeeper运行用户,内存使用情况
八,查看当前zookeeper服务器上所有连接的信息
[liuhongdi@localhost ~]$ echo cons | nc localhost 2181
九,使用zktop做为管理工具
1,下载地址
https://github.com/phunt/zktop
2,解压缩
[root@localhost source]# unzip zktop-master.zip [root@localhost source]# cd zktop-master/ [root@localhost zktop-master]# ls LICENSE.txt README.textile setup.cfg setup.py zktop.py
3,运行zktop
[root@localhost zktop-master]# /usr/bin/python3.6 ./zktop.py --servers "localhost:2181"