Replication

Replication and the Leader-Follower Model

Each partition has replication.factor replicas on different brokers. The leader handles all writes and, by default, all reads; followers fetch from it like consumers and append to their own copies. Leadership is spread out: with three partitions on three brokers, each broker leads one and follows two. kafka-topics.sh --describe shows the leader, the replica list (its first entry is the preferred leader) and the in-sync set. Set broker.rack and the controller places replicas in different racks or zones; with client.rack, consumers may fetch from the nearest follower (since Kafka 2.4 129 ) to avoid cross-zone traffic.