Kafka partitions کو متعدد brokers میں durability اور availability کے لیے replicate کرتا ہے — ہر partition کا ایک leader اور follower replicas ہوتے ہیں۔ اگر کوئی broker ناکام ہو تو ایک follower اس کی جگہ لے لیتا ہے۔ Replication کو سمجھنا Kafka کی fault tolerance کے لیے اہم ہے۔
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
