Viewing topic information

You can also use the following kcat command to view broker and topic information. Remember to replace the bootstrap server and credentials as described in previous examples.

$ kcat -b $BOOTSTRAP_SERVER \
-X security.protocol=SASL_SSL \
-X sasl.mechanisms=PLAIN \
-X sasl.username="$CLIENT_ID" \
-X sasl.password="$CLIENT_SECRET" -L

The output will resemble the following:

Metadata for all topics (from broker -1: sasl_ssl://game-kafka-c--ungpmsi-k-ft-vnpg.bf2.kafka.rhcloud.com:443/bootstrap):
 3 brokers:
  broker 0 at broker-0-game-kafka-c--ungpmsi-k-ft-vnpg.bf2.kafka.rhcloud.com:443 (controller)
  broker 2 at broker-2-game-kafka-c--ungpmsi-k-ft-vnpg.bf2.kafka.rhcloud.com:443
  broker 1 at broker-1-game-kafka-c--ungpmsi-k-ft-vnpg.bf2.kafka.rhcloud.com:443
 1 topic:
  topic "songs" with 1 partitions:
    partition 0, leader 1, replicas: 1,0,2, isrs: 1,0,2

This output explains that the single partition of the songs topic is replicated across all three brokers, and that broker 1 is the leader of the partition. The replicas are populated by following the leader state.