Suppose an online store keeps price changes in a Kafka topic. If a broker holding a partition fails, another broker needs a copy of its data. A follower is a broker that stores a replica of a partition and continuously fetches new messages from that partition’s leader. If the leader fails, a follower can take over. section 4.2.3
Each partition has one leader. Producers and consumers normally communicate with that leader, not its followers. A replication factor of three means three replicas in the normal state: one leader and two followers. The replication factor cannot exceed the number of available brokers. section 4.2.3
Create and inspect a replicated topic
With three brokers available, run `kafka-topics.sh --create --topic products.prices.replication --partitions 3 --replication-factor 3 --bootstrap-server localhost:9092`. Then use `kafka-topics.sh --describe --topic products.prices.replication --bootstrap-server localhost:9092` to inspect each partition’s leader, replicas and in-sync replicas (ISR). In the shown output, partition 0 has broker 2 as leader and brokers 1 and 3 as its other replicas. section 4.2.3
$ kafka-topics.sh \
--describe \
--topic products.prices.replication \
--bootstrap-server localhost:9092
Topic: products.prices.replication PartitionCount: 3 ReplicationFactor: 3
Configs: #1
Topic: products.prices.replication Partition: 0 Leader: 2 Replicas: 2,1,3
Isr: 2,1,3 Elr: #2
Topic: products.prices.replication Partition: 1 Leader: 3 Replicas: 3,2,1
Isr: 3,2,1 Elr:
Topic: products.prices.replication Partition: 2 Leader: 1 Replicas: 1,3,2
Isr: 1,3,2 Elr:
Compare the Leader, Replicas and Isr fields across the three partitions. The leaders are distributed among brokers; each partition has three replicas. section 4.2.3
Check replica health as well as replica count. The ISR field identifies replicas that are up to date; a mismatch between ISR and Replicas can indicate a problem, such as a failed broker. Followers fetch data from the leader, and a leader may wait for replication before acknowledging a producer request. Replication lag can therefore affect availability and performance—not just failover readiness. section 4.2.3 section 8.5


