我们有Kafka集群,版本是0.10
我们只能捕获 segment.bytes
Zookeeper提供的价值
我们采取了以下方法
zookeeper-shell kafka1:2181 get /config/topics/topic_test
Connecting to kafka1:2181
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
{"version":1,"config":{"segment.bytes":"10737555","retention.bytes":"104857600"}}
cZxid = 0xb30a00000038
ctime = Mon Jun 29 11:42:30 GMT 2020
mZxid = 0xb311000089d7
mtime = Fri Jul 24 08:04:38 GMT 2020
pZxid = 0xb30a00000038
cversion = 0
dataVersion = 9
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 81
numChildren = 0
我们可以从上面看到,也有许多细节打印输出
我想知道我们是否可以运行zookeeper shell,以便只获取 "retention.bytes":"104857600"
细节
也许我用的是主题的路径而不是其他路径?
所以预期的结果应该是
例子
zookeeper-shell kafka1:2181 get /config/topics/topic_test
Connecting to kafka1:2181
WATCHER::
retention.bytes":"104857600
1条答案
按热度按时间qojgxg4l1#
zookeeper-shell
无法分析json。它只打印存储在znodes中的二进制数据您需要围绕该命令编写解析代码来提取数据