Support Questions
Find answers, ask questions, and share your expertise

kafka + how to verify if kafka broker leaders are balanced with kafka cli commands

we have Kafka cluster with different versions

 

kafka cluster confluent with version 1.0

kafka cluster Apache with version 2.7

 

 

we want to test the leader if balance on our topics
the target is verify on each topic that leaders are balanced to partitions

here is example when Kafka broker leaders are balanced

we can see that we have 4 (1001 ) , 3 (1002 ) , 3 ( 1003 )

 


Topic:drive.car.cost.val PartitionCount:10 ReplicationFactor:3 Configs:segment.bytes=53687091,retention.bytes=53687091
Topic: drive.car.cost.val Partition: 0 Leader: 1001 Replicas: 1001,1002,1003 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 1 Leader: 1002 Replicas: 1002,1003,1001 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 2 Leader: 1003 Replicas: 1003,1001,1002 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 3 Leader: 1001 Replicas: 1001,1003,1002 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 4 Leader: 1002 Replicas: 1002,1001,1003 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 5 Leader: 1003 Replicas: 1003,1002,1001 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 6 Leader: 1001 Replicas: 1001,1002,1003 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 7 Leader: 1002 Replicas: 1002,1003,1001 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 8 Leader: 1003 Replicas: 1003,1001,1002 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 9 Leader: 1001 Replicas: 1001,1003,1002 Isr: 1001,1002,1003


and here is example that leader brokers are not balanced



we can see that we have 1 (1001 ) , 2 (1002 ) , 7 ( 1003 )

Topic:drive.car.cost.val PartitionCount:10 ReplicationFactor:3 Configs:segment.bytes=53687091,retention.bytes=53687091
Topic: drive.car.cost.val Partition: 0 Leader: 1001 Replicas: 1001,1002,1003 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 1 Leader: 1002 Replicas: 1002,1003,1001 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 2 Leader: 1003 Replicas: 1003,1001,1002 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 3 Leader: 1003 Replicas: 1001,1003,1002 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 4 Leader: 1003 Replicas: 1002,1001,1003 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 5 Leader: 1003 Replicas: 1003,1002,1001 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 6 Leader: 1003 Replicas: 1001,1002,1003 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 7 Leader: 1002 Replicas: 1002,1003,1001 Isr: 1002,1001,1003
Topic: drive.car.cost.val Partition: 8 Leader: 1003 Replicas: 1003,1001,1002 Isr: 1001,1002,1003
Topic: drive.car.cost.val Partition: 9 Leader: 1003 Replicas: 1001,1003,1002 Isr: 1001,1002,1003



so we build python script that count and calculate the kafka leaders , and verify if we have balanced

but I want to know if kafka itself have some cli that can tell us if leaders are balanced per partition

 

Michael-Bronson
0 REPLIES 0