欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Four Letter Words

程序员文章站 2022-05-14 22:58:47
...

用途:Zookeeper可以通过Four Letter Words自身提供的简写命令来和服务器进行交互
安装:yum install nc

常用命令:

[stat] 查看zk的状态信息,以及是否mode

[[email protected] ~]# echo stat | nc 172.16.1.160 2181
Zookeeper version: 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
Clients:
 /172.16.1.160:51288[0](queued=0,recved=1,sent=0)

Latency min/avg/max: 0/0/184
Received: 1455
Sent: 1461
Connections: 1
Outstanding: 0
Zxid: 0x20000001d
Mode: follower
Node count: 11

[ruok] 查看当前zkServer是否启动,返回imok

[[email protected] ~]# echo ruok | nc 172.16.1.160 2181
imok[[email protected] ~]# 

[dump] 列出未经吃力的会话和临时节点

[[email protected] ~]# echo dump | nc 172.16.1.160 2181
SessionTracker dump:
[email protected]7
ephemeral nodes dump:
Sessions with Ephemerals (1):
0x1669eba65330001:
	/names/tmp-dump

[conf] 查看服务器配置信息

[[email protected] ~]# echo conf | nc 172.16.1.160 2181
clientPort=2181
dataDir=/root/zookeeper/data/version-2
dataLogDir=/root/zookeeper/logs/version-2
tickTime=2000
maxClientCnxns=60
minSessionTimeout=4000
maxSessionTimeout=40000
serverId=1
initLimit=10
syncLimit=5
electionAlg=3
electionPort=3888
quorumPort=2888
peerType=0

[cons] 展示连接到服务器的客户端信息

[[email protected] ~]# echo cons | nc 172.16.1.160 2181
 /172.16.1.160:51308[0](queued=0,recved=1,sent=0)
 /127.0.0.1:60184[1](queued=0,recved=29,sent=29,sid=0x1669eba65330001,lop=PING,est=1540277571410,to=30000,lcxid=0x3,lzxid=0xffffffffffffffff,lresp=1540277834135,llat=0,minlat=0,avglat=2,maxlat=67)

[envi] 环境变量

[[email protected] ~]# echo envi | nc 172.16.1.160 2181
Environment:
zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
host.name=localhost
java.version=1.8.0_181
java.vendor=Oracle Corporation
java.home=/root/jdk1.8.0_181/jre
java.class.path=/root/zookeeper/bin/../build/classes:/root/zookeeper/bin/../build/lib/*.jar:/root/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/root/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/root/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/root/zookeeper/bin/../lib/log4j-1.2.16.jar:/root/zookeeper/bin/../lib/jline-0.9.94.jar:/root/zookeeper/bin/../zookeeper-3.4.10.jar:/root/zookeeper/bin/../src/java/lib/*.jar:/root/zookeeper/bin/../conf:
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=3.10.0-862.el7.x86_64
user.name=root
user.home=/root
user.dir=/root/zookeeper/bin

[mntr] 查看健康信息

[[email protected] ~]# echo mntr | nc 172.16.1.160 2181
zk_version	3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency	0
zk_max_latency	184
zk_min_latency	0
zk_packets_received	1508
zk_packets_sent	1514
zk_num_alive_connections	2
zk_outstanding_requests	0
zk_server_state	follower
zk_znode_count	12
zk_watch_count	0
zk_ephemerals_count	1
zk_approximate_data_size	134
zk_open_file_descriptor_count	34
zk_max_file_descriptor_count	4096

[wchs] 展示watches

[[email protected] ~]# echo wchs | nc 172.16.1.160 2181
0 connections watching 0 paths
Total watches:0
相关标签: Zookeeper