Healthy Kafka Cluster — Zero Under Replicated Partition

Healthy Kafka Cluster — Zero Under Replicated Partition

Healthy Kafka Cluster

Get the under-replicated-partitions

docker run --net=host --rm confluentinc/cp-kafka:4.0.0 kafka-topics --zookeeper 192.31.1.1:22181  --describe --under-replicated-partitions

Output

Topic: country     Partition: 0    Leader: 1   Replicas: 1,2   Isr: 1  
Topic: geodata      Partition: 0    Leader: 1   Replicas: 1,2   Isr: 1  
Topic: workspace Partition: 0    Leader: 1   Replicas: 1,2   Isr: 1

There are three topics that have the issue with replication factor i.e, cluster is not healthy. When the above query gives no output then the cluster is healthy. Reassignment of the partitions is required to make it healthy.

If you have topics that have replication set to one? If the cluster size is higher, then reassignment needs to be considered to maintain the high availability of the topic for consumers, when a topic containing broker is restarting, then the topic goes offline.

To know in detail about individual topics run the describe topic command.

docker run --net=host --rm confluentinc/cp-kafka:4.0.0 kafka-topics --zookeeper 192.31.1.1:22181 --describe --topic country