Replication: leader and follower
In short: With replication you keep copies of the same data on several servers. Usually one leader writes, and followers adopt the changes and answer read requests.
In more detail: Replication increases fault tolerance and read capacity. It can be synchronous (write waits for followers, slow, safe) or asynchronous (fast, but data loss possible if the leader fails).
In Depth
- Leader-follower: One write node, many read replicas.
- Multi-leader: Several write nodes, for example per region. Conflicts must be resolved.
- Leaderless: Clients write to several nodes (Dynamo style), quorum reads/writes.
- Replication lag: Followers fall behind. Consequence: “read your own writes” can fail.
- Failover: Promoting a follower to leader. Risk: split brain with two “leaders”.
- Synchronous vs. asynchronous: Trade-off between durability and speed.
See also: Distributed consensus (Paxos and Raft), Consistency models and eventual consistency