jessica
jessica

Reputation: 2610

how to get specific details from zookeeper and not all info that isn't required

we have kafka cluster, version is 0.10

we can capture only the segment.bytes value from zookeeper

we did the following approach

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

we can see from above that also many details are printed from output

I want to know if we can run the zookeeper-shell in order to get only the "retention.bytes":"104857600" details

maybe I am using the path of the topic instead other path ?

so the expected results should be

example

zookeeper-shell kafka1:2181 get /config/topics/topic_test                                                           
Connecting to kafka1:2181

WATCHER::

retention.bytes":"104857600

Upvotes: 1

Views: 221

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191758

zookeeper-shell cannot parse JSON. It only prints the binary data that is stored in the ZNodes

You will need to write parsing code around that command to extract that data

Upvotes: 1

Related Questions