zookeeper 四字命令的shi yong

Posted 星星满天

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zookeeper 四字命令的shi yong相关的知识,希望对你有一定的参考价值。

   Linux中的命令NetCat有“瑞士军刀”的美誉。我们可以通过nc命令查看Zookeeper的一行属性数据。在Zookeeper中有很多四字命令,汇总如下:

 

序号 使用命令 输出说明
 1 echo conf | nc 10.9.3.253 2181  输出Zookeeper相关服务的详细配置信息,如客户端端口,数据存储路径、最大连接数、日志路径、数据同步端口、主节点推举端口、session超时时间等等
 2 echo cons | nc 10.9.3.253 2181  输出连接到Zookeeper的服务器信息,包括队列、数据接收量、数据发送量、sessionID、操作延时、最后的操作信息等等
 3 echo crst | nc 10.9.3.253 2181  重置当前的所有连接、会话等等
 4 echo dump | nc 10.9.3.253 2181  列出未经处理的会话和连接信息
 5 echo envi | nc 10.9.3.253 2181  列出zookeeper的版本信息、主机名称、Java版本、java_home、class_path、服务器名称、当前登陆用户名、目录等等;
 6 echo ruok | nc 10.9.3.253 2181  Are You Ok的缩写,测试服务器是否正在运行,如果在运行返回imok,否则返回空
 7 echo srst | nc 10.9.3.253 2181  重置Zookeeper的所有统计信息
 8 echo srvr | nc 10.9.3.253 2181  列出zookeeper的版本信息、数据接收/发送量、连接数、节点模式、Node数、最大/平均/最小延迟数
 9 echo stat | nc 10.9.3.253 2181  列出连接客户端列表、最大/平均/最小延迟数、数据接收/发送量、连接数、节点总数、模式
 10 echo wchs | nc 10.9.3.253 2181  列出watch的总数,连接数
 11 echo wchp | nc 10.9.3.253 2181  列出所有watch的路径及sessionID
 12 echo mntr | nc 10.9.3.253 2181  列出集群的关键性能数据,包括zk的版本、最大/平均/最小延迟数、数据包接收/发送量、连接数、zk角色(Leader/Follower)、node数量、watch数量、临时节点数
     

  1、echo conf | nc 10.9.3.253 2181

clientPort=2181
dataDir=/home/zookeeper/zookeeper-3.4.8/data/version-2
dataLogDir=/home/zookeeper/zookeeper-3.4.8/data/version-2
tickTime=2000
maxClientCnxns=60
minSessionTimeout=4000
maxSessionTimeout=40000
serverId=2
initLimit=10
syncLimit=5
electionAlg=3
electionPort=2223
quorumPort=2222
peerType=0

  2、echo cons | nc 10.9.3.253 2181

 /10.9.3.210:27080[1](queued=0,recved=21379,sent=21379,sid=0x26128063230003a,lop=PING,est=1517842262650,to=6000,lcxid=0x25,lzxid=0x500000e68,lresp=1517885010952,llat=0,minlat=0,avglat=1,maxlat=1832)
 /10.9.3.2:52081[0](queued=0,recved=1,sent=0)
 /10.9.3.253:53132[1](queued=0,recved=81690,sent=81690,sid=0x160e4217689000a,lop=PING,est=1516794950707,to=40000,lcxid=0x0,lzxid=0x500000e68,lresp=1517885010871,llat=0,minlat=0,avglat=0,maxlat=3667)
 /10.9.3.253:41271[1](queued=0,recved=89801,sent=89801,sid=0x260e42176ee0005,lop=GETC,est=1516868422715,to=40000,lcxid=0xd443,lzxid=0x500000e68,lresp=1517885009146,llat=0,minlat=0,avglat=1,maxlat=2328)
 /127.0.0.1:41248[1](queued=0,recved=21359,sent=21359,sid=0x260e42176ee0534,lop=PING,est=1517842262534,to=6000,lcxid=0xf0,lzxid=0x500000e68,lresp=1517885012461,llat=0,minlat=0,avglat=1,maxlat=1535)
 /10.9.3.253:53136[1](queued=0,recved=81692,sent=81692,sid=0x160e42176890009,lop=PING,est=1516794950841,to=40000,lcxid=0x5a,lzxid=0x500000e68,lresp=1517885009000,llat=0,minlat=0,avglat=1,maxlat=4846)

  3、echo crst  | nc 10.9.3.253 2181  

Connection stats reset.

  4、echo dunp | nc 10.9.3.253 2181

Sessions with Ephemerals (4):
0x160e42176890009:
    /hbase/rs/log1,16020,1515656342319
0x260e42176ee0005:
    /hbase/master
0x260e42176ee0534:
    /kafka/controller
    /kafka/brokers/ids/253
0x26128063230003a:
    /kafka/brokers/ids/210

  5、echo envi |nc 10.9.3.253 2181

nvironment:
zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
host.name=log1
java.version=1.8.0_102
java.vendor=Oracle Corporation
java.home=/opt/jdk1.8.0_102/jre
java.class.path=/home/zookeeper/zookeeper-3.4.8/bin/../build/classes:/home/zookeeper/zookeeper-3.4.8/bin/../build/lib/*.jar:/home/zookeeper/zookeeper-3.4.8/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/zookeeper/zookeeper-3.4.8/bin/../lib/slf4j-api-1.6.1.jar:/home/zookeeper/zookeeper-3.4.8/bin/../lib/netty-3.7.0.Final.jar:/home/zookeeper/zookeeper-3.4.8/bin/../lib/log4j-1.2.16.jar:/home/zookeeper/zookeeper-3.4.8/bin/../lib/jline-0.9.94.jar:/home/zookeeper/zookeeper-3.4.8/bin/../zookeeper-3.4.8.jar:/home/zookeeper/zookeeper-3.4.8/bin/../src/java/lib/*.jar:/home/zookeeper/zookeeper-3.4.8/bin/../conf:.:/opt/jdk1.8.0_102/lib/dt.jar:/opt/jdk1.8.0_102/lib/tools.jar
java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.io.tmpdir=/tmp
java.compiler=<NA>
os.name=Linux
os.arch=amd64
os.version=2.6.32-431.el6.x86_64
user.name=zookeeper
user.home=/home/zookeeper
user.dir=/home/zookeeper/zookeeper-3.4.8/bin

  6、echo ruok | nc 10.9.3.253 2181

imok

  7、echo srsr | nc 10.9.3.253 2181 

Server stats reset.

  8、echo srvr | nc 10.9.3.253 2181

Zookeeper version: 3.4.8--1, built on 02/06/2016 03:18 GMT
Latency min/avg/max: 0/0/1
Received: 160
Sent: 160
Connections: 6
Outstanding: 0
Zxid: 0x500000e68
Mode: leader
Node count: 200

  9、echo stat | nc 10.9.3.253 2181

Zookeeper version: 3.4.8--1, built on 02/06/2016 03:18 GMT
Clients:
 /10.9.3.210:27080[1](queued=0,recved=688,sent=688)
 /10.9.3.253:53132[1](queued=0,recved=103,sent=103)
 /10.9.3.253:41271[1](queued=0,recved=123,sent=123)
 /127.0.0.1:41248[1](queued=0,recved=687,sent=687)
 /10.9.3.2:52642[0](queued=0,recved=1,sent=0)
 /10.9.3.253:53136[1](queued=0,recved=103,sent=103)

Latency min/avg/max: 0/0/1
Received: 481
Sent: 481
Connections: 6
Outstanding: 0
Zxid: 0x500000e68
Mode: leader
Node count: 200

   10、echo wchs | nc 10.9.3.253 2181

4 connections watching 19 paths
Total watches:24

 

  11、echo wchp | nc 10.9.3.253 2181

/kafka/brokers/topics/asda
    0x260e42176ee0534
/kafka/controller
    0x260e42176ee0534
    0x26128063230003a
/kafka/isr_change_notification
    0x260e42176ee0534
/kafka/brokers/topics
    0x260e42176ee0534
/hbase/running
    0x260e42176ee0005
    0x160e42176890009
/kafka/brokers/topics/test
    0x260e42176ee0534
/hbase/master
    0x260e42176ee0005
    0x160e42176890009
/kafka/config/changes
    0x260e42176ee0534
    0x26128063230003a
/hbase/namespace
    0x260e42176ee0005
/kafka/brokers/ids
    0x260e42176ee0534
/hbase/namespace/hbase
    0x260e42176ee0005
/kafka/admin/reassign_partitions
    0x260e42176ee0534
/hbase/meta-region-server
    0x160e42176890009
/hbase/rs/log1,16020,1515656342319
    0x260e42176ee0005
    0x160e42176890009
/hbase/namespace/default
    0x260e42176ee0005
/hbase/normalizer
    0x260e42176ee0005
/kafka/admin/delete_topics
    0x260e42176ee0534
/hbase/balancer
    0x260e42176ee0005
/kafka/admin/preferred_replica_election
    0x260e42176ee0534

 12、echo mntr | nc 10.9.3.253 2181

zk_version    3.4.8--1, built on 02/06/2016 03:18 GMT
zk_avg_latency    0
zk_max_latency    1
zk_min_latency    0
zk_packets_received    2876
zk_packets_sent    2876
zk_num_alive_connections    6
zk_outstanding_requests    0
zk_server_state    leader
zk_znode_count    200
zk_watch_count    41
zk_ephemerals_count    5
zk_approximate_data_size    35502
zk_open_file_descriptor_count    37
zk_max_file_descriptor_count    65536
zk_followers    1
zk_synced_followers    1
zk_pending_syncs    0

 

以上是关于zookeeper 四字命令的shi yong的主要内容,如果未能解决你的问题,请参考以下文章

11、Zookeeper的四字命令

Zookeeper学习 安装和四字命令

zookeeper命令使用及监控

转zookeeper之 zkServer.sh命令zkCli.sh命令四字命令

zookeeper权限acl与四字命令

从零玩转Yaip使用-cong-ling-wan-zhuan-yaip-shi-yong