What is Kafka's replication mechanism?
Answer
Kafka replicates each partition across multiple brokers for fault tolerance. The replication factor (typically 3) determines how many copies exist. One broker is the partition leader — all reads and writes go to the leader. Other brokers are followers that replicate the leader's log. In-Sync Replicas (ISR): the set of replicas fully caught up with the leader. If the leader fails, a new leader is elected from the ISR. A message is considered "committed" when all ISR replicas have written it. This ensures no data loss when any ISR member becomes the new leader. Configure min.insync.replicas=2 with acks=all to require at least 2 ISR acknowledgements — providing strong durability guarantees. If an ISR falls behind, it is removed from the ISR set until it catches up.