MrEvil
MrEvil

Reputation: 8073

Determine a Kafka broker's ID from JMX

Given a broker host/ip is there a way to interrogate it to learn the broker ID other than by querying ZK? I'm trying to map the IP to the broker ID for monitoring. ZK is authenticated and I don't have access. I'm preferably looking for a value in JMX.

Upvotes: 1

Views: 363

Answers (2)

BeeHellTea
BeeHellTea

Reputation: 11

Thank you for the information Mickael.

Also want to add the info I found out since the broker ID seemed to be only retrieved when the called ObjectName contains broker ID (which kind of obvious)

In my case I appended '?' to the end of the ObjectName e.g: kafka.server:type=app-info,id=? so that the broker ID can be retrieved when using queryNames

Just remind that with one '?' will only handle broker ID with one character (from 0 to 9) so if you want to retrieve for example broker ID = 99 then you will need "??" at the end.

Upvotes: 1

Mickael Maison
Mickael Maison

Reputation: 26885

Yes the broker ID can be retrieved from JMX.

It is located in the ObjectName called kafka.server:type=app-info.

For example, for broker with ID 1: kafka.server:type=app-info,id=1

Upvotes: 2

Related Questions