Kafkaはレプリケーションにより複数のブローカー間でパーティションを複製し、耐久性と可用性を実現します — 各パーティションはリーダーとフォロワーレプリカを持ちます。ブローカーに障害が発生した場合、フォロワーが引き継ぎます。レプリケーションの仕組みを理解することは、Kafkaのフォールトトレランスの鍵です。
レプリケーションの仕組み
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
