You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Girish L <gi...@gmail.com> on 2021/06/02 18:44:41 UTC

CLI command : Apache Kafka : to check LEADER

hello all .. in apache kafka, could you please share the CLI command to
check the Leader among the broker ..
one command that can be run in the kafka broker cluster which gives the
leader instance as output.

Thanks

Re: CLI command : Apache Kafka : to check LEADER

Posted by Girish L <gi...@gmail.com>.
Understood... Thank you very much Ran

On Thu, 3 Jun, 2021, 12:31 am Ran Lupovich, <ra...@gmail.com> wrote:

> There is no one leader in kafka cluster for the a topic's partition, there
> could be a different leader for each partition,
>
>
> ./bin/kafka-topics --describe --topic topic-a --bootstrap-server
> localhost:9092
>
> Topic:topic-a        PartitionCount:4        ReplicationFactor:2
>  Configs:
>    Topic: topic-a    Partition: 0    Leader: 0       Replicas: 0,1   Isr:
> 0,1
>    Topic: topic-a    Partition: 1    Leader: 0       Replicas: 0,1   Isr:
> 0,1
>    Topic: topic-a    Partition: 2    Leader: 0       Replicas: 0,1   Isr:
> 0,1
>    Topic: topic-a    Partition: 3    Leader: 0       Replicas: 0,1   Isr:
> 0,1
>
> ./bin/kafka-topics --describe --topic topic-b --bootstrap-server
> localhost:9092
>
> Topic:topic-b        PartitionCount:4        ReplicationFactor:2
>  Configs:
>   Topic: topic-b     Partition: 0    Leader: 1       Replicas: 1,0   Isr:
> 1,0
>   Topic: topic-b     Partition: 1    Leader: 2       Replicas: 2,1   Isr:
> 2,1
>   Topic: topic-b     Partition: 2    Leader: 1       Replicas: 1,2   Isr:
> 1,2
>   Topic: topic-b     Partition: 3    Leader: 2       Replicas: 2,1   Isr:
> 2,1
>
>
>
> There is one kafka controller which is the "leader" of cluster,
>
> You can find out which is the controller by the following command
>
> ./bin/zookeeper-shell.sh [ZK_IP] get /controller
>
>
>
>
> בתאריך יום ד׳, 2 ביוני 2021, 21:45, מאת Girish L ‏<gi...@gmail.com>:
>
> > hello all .. in apache kafka, could you please share the CLI command to
> > check the Leader among the broker ..
> > one command that can be run in the kafka broker cluster which gives the
> > leader instance as output.
> >
> > Thanks
> >
>

Re: CLI command : Apache Kafka : to check LEADER

Posted by Ran Lupovich <ra...@gmail.com>.
There is no one leader in kafka cluster for the a topic's partition, there
could be a different leader for each partition,


./bin/kafka-topics --describe --topic topic-a --bootstrap-server localhost:9092

Topic:topic-a        PartitionCount:4        ReplicationFactor:2     Configs:
   Topic: topic-a    Partition: 0    Leader: 0       Replicas: 0,1   Isr: 0,1
   Topic: topic-a    Partition: 1    Leader: 0       Replicas: 0,1   Isr: 0,1
   Topic: topic-a    Partition: 2    Leader: 0       Replicas: 0,1   Isr: 0,1
   Topic: topic-a    Partition: 3    Leader: 0       Replicas: 0,1   Isr: 0,1

./bin/kafka-topics --describe --topic topic-b --bootstrap-server localhost:9092

Topic:topic-b        PartitionCount:4        ReplicationFactor:2     Configs:
  Topic: topic-b     Partition: 0    Leader: 1       Replicas: 1,0   Isr: 1,0
  Topic: topic-b     Partition: 1    Leader: 2       Replicas: 2,1   Isr: 2,1
  Topic: topic-b     Partition: 2    Leader: 1       Replicas: 1,2   Isr: 1,2
  Topic: topic-b     Partition: 3    Leader: 2       Replicas: 2,1   Isr: 2,1



There is one kafka controller which is the "leader" of cluster,

You can find out which is the controller by the following command

./bin/zookeeper-shell.sh [ZK_IP] get /controller




בתאריך יום ד׳, 2 ביוני 2021, 21:45, מאת Girish L ‏<gi...@gmail.com>:

> hello all .. in apache kafka, could you please share the CLI command to
> check the Leader among the broker ..
> one command that can be run in the kafka broker cluster which gives the
> leader instance as output.
>
> Thanks
>