Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Solved Go to solution
Highlighted

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

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

Accepted Solutions
Highlighted

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

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
Highlighted

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

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

Don't have an account?
Coming from Hortonworks? Activate your account here