四字命令(ruok、stat、mntr……)是 ZooKeeper 运维最古老的接口。现在它默认几乎全部被禁用了。这篇把每条命令在默认配置和放开白名单之后的真实输出都打印一遍。
默认白名单生效的配置行: (没有写 4lw 白名单)
ruok → ruok is not executed because it is not in the whitelist.
srvr → Zookeeper version: 3.9.6-${mvngit.commit.id}, built on 2026-09-14 21:34 UTC
stat → stat is not executed because it is not in the whitelist.
conf → conf is not executed because it is not in the whitelist.
cons → cons is not executed because it is not in the whitelist.
crst → crst is not executed because it is not in the whitelist.
dirs → dirs is not executed because it is not in the whitelist.
dump → dump is not executed because it is not in the whitelist.
envi → envi is not executed because it is not in the whitelist.
gtmk → gtmk is not executed because it is not in the whitelist.
isro → isro is not executed because it is not in the whitelist.
mntr → mntr is not executed because it is not in the whitelist.
srst → srst is not executed because it is not in the whitelist.
wchc → wchc is not executed because it is not in the whitelist.
wchp → wchp is not executed because it is not in the whitelist.
wchs → wchs is not executed because it is not in the whitelist.
hash → hash is not executed because it is not in the whitelist.
日志里的启用列表: ['The list of enabled four letter word commands is : [[srvr]]'] [ruok]
imok
[srvr]
Zookeeper version: 3.9.6-${mvngit.commit.id}, built on 2026-09-14 21:34 UTC
Latency min/avg/max: 1/5.25/9
Received: 8
[stat]
Zookeeper version: 3.9.6-${mvngit.commit.id}, built on 2026-09-14 21:34 UTC
Clients:
/127.0.0.1:59127[0](queued=0,recved=1,sent=0)
[conf]
clientPort=7301
secureClientPort=-1
dataDir=<实验目录>
[cons]
/127.0.0.1:59123[1](queued=0,recved=3,sent=3,sid=0x1000c5946950000,lop=GETD,est=1790827416994,to=10000,lcxid=0
/127.0.0.1:59124[1](queued=0,recved=1,sent=1,sid=0x1000c5946950001,lop=SESS,est=1790827417020,to=10000,lcxid=
/127.0.0.1:59129[0](queued=0,recved=1,sent=0)
[dirs]
datadir_size: 67109358
logdir_size: 67109358
[dump]
SessionTracker dump:
Session Sets (1)/(2):
2 expire at Thu Oct 01 12:03:47 CST 2026:
[envi]
Environment:
zookeeper.version=3.9.6-${mvngit.commit.id}, built on 2026-09-14 21:34 UTC
host.name=localhost
[gtmk]
306
[isro]
rw
[wchs]
1 connections watching 1 paths
Total watches:1
[wchp]
/a
0x1000c5946950000
[wchc]
0x1000c5946950000
/a另外还有 mntr、crst、srst、hash 等命令,mntr 的输出在第 65 篇,srst / crst 会清零统计(第 67 篇)。