2
votes

In my kafka Cluster there are more than 2k topics and each topic has 5 partitions. I want list only that partitions which has no leader.

I can go can check for each topic using the below syntax:

kafka-topics.sh --describe --topic <topic_name> --zookeeper <zookeeper_ip>:port

But the problem is there are 2k+ topics, can't be done manually. I can also write a script to loop over each topic and get the partition with no leader. But i am interested in some efficient way to get the information.

1

1 Answers

4
votes

Using kafka-topics.sh you can specify the --unavailable-partitions flag to only list partitions that currently don't have a leader and hence cannot be used by Consumers or Producers.

For example:

kafka-topics.sh --describe --unavailable-partitions --zookeeper <zookeeper_ip>:port