Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

kafka configuration + zookeeper cli + get the right info for kafka host

avatar

As all know when is need to print the kafka broker id’s we can use the following cli

zookeeper-shell.sh zoo_server1:2181 <<< "ls /brokers/ids"


this cli print the following

 


WatchedEvent state:SyncConnected type:None path:null
[1018, 1017, 1016]

 

Its means that we have kafka with id’s

1018
1017
1016


But our kafka names are

 

Kafka_confluent01
Kafka_confluent02
Kafka_confluent03


So how to know which kafka broker id ( 1018 , 1017 , 1016 ) is belong to the real host ( Kafka_confluent01 / Kafka_confluent02 / Kafka_confluent03 )

 

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Expert Contributor

Hello @mike_bronson7 ,

 

Thank you for posting your query

 

You can execute 'get' on the same zookeeper client shell for the znode you would be able to get the hostname

 

Example:

zookeeper-shell.sh zoo_server1:2181 <<< "ls /brokers/ids/1018"

 

It returns output as follows (example - in my case)

[zk: localhost:2181(CONNECTED) 5] get /brokers/ids/10
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://simple01.cloudera.com:9092"],"jmx_port":9393,"host":"simple01.cloudera.com","timestamp":"1590512066422","port":9092,"version":4}
cZxid = 0x1619b
ctime = Tue May 26 09:54:26 PDT 2020
mZxid = 0x1619b
mtime = Tue May 26 09:54:26 PDT 2020
pZxid = 0x1619b
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x1722ddb1e844d50
dataLength = 238
numChildren = 0

 

so, my brokerID 10 is mapped with the host: simple01.cloudera.com

 

Thanks,
Satz

View solution in original post

1 REPLY 1

avatar
Expert Contributor

Hello @mike_bronson7 ,

 

Thank you for posting your query

 

You can execute 'get' on the same zookeeper client shell for the znode you would be able to get the hostname

 

Example:

zookeeper-shell.sh zoo_server1:2181 <<< "ls /brokers/ids/1018"

 

It returns output as follows (example - in my case)

[zk: localhost:2181(CONNECTED) 5] get /brokers/ids/10
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://simple01.cloudera.com:9092"],"jmx_port":9393,"host":"simple01.cloudera.com","timestamp":"1590512066422","port":9092,"version":4}
cZxid = 0x1619b
ctime = Tue May 26 09:54:26 PDT 2020
mZxid = 0x1619b
mtime = Tue May 26 09:54:26 PDT 2020
pZxid = 0x1619b
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x1722ddb1e844d50
dataLength = 238
numChildren = 0

 

so, my brokerID 10 is mapped with the host: simple01.cloudera.com

 

Thanks,
Satz