Find broker id used in the Kafka cluster

apache-kafka

Solution

You can get list of used broker ids using zookeeper cli.

zookeeper-3.4.8$ ./bin/zkCli.sh -server zookeeper-1:2181 ls /brokers/ids | tail -1
[0]

Problem

I want to know the list of taken broker ids in a kafka cluster. For example, in a cluster with 10 nodes if I create a topic with 10 partitions(or more) I can see from the output of a describe topic command, the brokers to which it has been assigned. ``` ./bin/kafka-topics --describe --zookeeper <zkconnect>:2181 --topic rbtest3 ``` Can I collect this information without creating a topic?

Original source