How to Describe Kafka Topic

Learn to Describe Kafka Topic for knowing the leader for the topic and the broker instances acting as replicas for the topic, and the number of partitions of a Kafka Topic that has been created with.

For creating a kafka Topic, refer Create a Topic in Kafka Cluster.

Describe Topic

Consider there are three broker instances running on a local machine and to know which kafka broker is doing what with a kafka topic(say my-topic), run the following command

Replace my-topic  with your topic name. And also, it is assumed that you are running kafka with default configuration (zookeeper running at 2181).

The result explains that

Leader: 1 meaning broker instance 1 is responsible for all reads and writes for the given partition. Reads and Writes are done by Kafka Consumers and Kafka Producers respectively.

Replicas: 1,2,0 meaning broker instances 0, 1 and 2 are acting as nodes that replicate the log irrespective of one being a leader.

Isr: 1,2,0 meaning broker instances 1, 2 and 0 are in-sync replicas.

PartitionCount:1 and ReplicationFactor:3 are the details used while creating the topic.

Now Kafka Producers may send messages to the Kafka topic, my-topic and Kafka Consumers may subscribe to the Kafka Topic.

 

Conclusion :

In this Apache Kafka Tutorial – Describe Kafka Topic, we have learnt to check Kafka Broker Instance that is acting as leader for a Kafka Topic, and the Broker Instances acting as replicas and in-sync replicas for the Kafka Topic.