Replication

Pramod Narayana
2 min readNov 26, 2020

Previous article was about Topic and Partition. In the article, we will see Kafka Partition

Replication

  1. As shown in the above figure, the sensor topic is created with 3 partitions and 3 replications.
  2. 3 replications mean each partition will be replicated 3 times.
  3. Out of 3 replicas, 1 replica is designated as Leader replica while others are Follower replicas.
  4. The producer always sends messages to the Leader broker(Leader replica).
  5. The consumer always consumes messages from the Leader broker(Leader replica).
  6. Follower replicas are used for the fault-tolerant purpose.
  7. Follower brokers will fetch the messages from the Leader broker and append to its replica
  8. In the above figure, assume the green color replica is the Leader replica. Brokers b1, b2, and b4 are hosting Leader replica. So these brokers act as Leader brokers for these replicas.
  9. So a broker can act as a Leader broker and for one set of replicas and a Follower broker for another set of replicas.
  10. Broker b2 is the Leader broker for sensor-1 partition replica and Follower broker for sensor-0 partition replica
  11. The producer will only interact with Brokers b1, b2, and b4 to send and pull messages as they are the Leader brokers for sensor topic (Brokers hosting leader replica)

In the next article, we will see Controller Broker

--

--