Kafka replicate ਕਰਦਾ ਹੈ partitions ਨੂੰ ਬਹੁ-ਸੰਖਿਆ brokers ਤੋਂ ਪਾਰ durability ਅਤੇ availability ਲਈ — ਹਰੇਕ partition ਕੋਲ ਇੱਕ leader ਅਤੇ follower replicas ਹਨ। ਜੇ ਕੋਈ broker fail ਹੋ ਜਾਏ, ਤਾਂ ਇੱਕ follower ਇਸ ਦੀ ਥਾਂ ਲੈ ਲੈਂਦਾ ਹੈ। Kafka ਦੀ fault tolerance ਨੂੰ ਸਮਝਣ ਲਈ replication ਨੂੰ ਸਮਝਣਾ ਮਹੱਤਵਪੂਰਨ ਹੈ।
Replication ਕਿਵੇਂ ਕੰਮ ਕਰਦਾ ਹੈ
Each PARTITION is replicated across multiple brokers (REPLICATION FACTOR copies, e.g. 3):
→ LEADER replica → handles all reads and writes for the partition
→ FOLLOWER replicas → copy (replicate) the leader's data, staying in sync
→ producers/consumers interact with the LEADER; followers are backups
→ if the leader's broker FAILS → a follower is promoted to leader (failover) → no data loss,
continued availability
