Replication Architectures, Failover, Backups and Multi-Region
Overview
There is more than one way to arrange copies of data, and replicas alone do not protect you from every disaster.
This lesson previews the three common arrangements, then covers failover, backups and spreading across regions.
Detailed Notes
What are these
- Replication architecture: the arrangement that decides which copies accept writes.
- Failover: switching to a healthy copy when the active one fails.
- Backup: a saved snapshot of data from a point in time.
- Multi-region: running the system in data centres in different parts of the world.
The problem it solves
Copies must be organised, otherwise two machines might accept conflicting changes. And replication alone does not save you from everything: if someone deletes a table by mistake, that delete is replicated to every copy within seconds. A whole data centre can also go down. So we need clear rules, failover, backups and geographic spread.
How it works
Three architectures (a preview only; the details come in later chapters):
- Single-leader: one copy takes all writes and passes changes to the others, which serve reads. Simple, and no write conflicts. Most common (PostgreSQL, MySQL).
- Multi-leader: several copies accept writes, often one per region, and exchange changes. Writes are fast everywhere, but two leaders can change the same data at once, so conflicts must be resolved.
- Leaderless: any copy can accept a write, and the client sends it to several copies at once. Very resilient, but it needs extra rules to keep copies consistent (used by Cassandra and DynamoDB-style systems).
Failover. If the active copy fails, the system promotes a replica to take its place and directs traffic to it. This can be manual or automatic. Automatic failover is faster but must be careful: if the system wrongly believes the main copy is dead, you can end up with two copies both acting as main. How failures are detected is covered later.
Backups. A backup protects against mistakes, bugs and corruption, which replication copies faithfully. Keep regular snapshots, store them in a separate place, and test restoring them. Two numbers matter:
- RPO (recovery point objective): how much recent data you can afford to lose.
- RTO (recovery time objective): how long you can afford to be down.
Smaller numbers cost more.
Multi-region. Put copies in different regions so a regional outage does not take you down, and so users read from a nearby copy. The cost is higher latency between regions (data crossing the world takes time, see the Latency chapter), more money, and harder consistency. Common patterns: one active region with a standby ready to take over, or several regions all serving traffic.
A simple example
A company keeps its important papers in three offices (replicas). If one burns down, the others have the papers. But if an employee shreds a contract, all three offices shred it too. A locked archive of dated snapshots (a backup) is what saves you.
System design example
A video platform runs its main database in one region with a replica in a second. If the first region fails, the team promotes the second-region replica. They accept losing a second or two of the latest data (asynchronous replication, so RPO is a few seconds) and about five minutes of switchover time (RTO). Daily snapshots go to storage in a third location, protecting against accidental deletes.
Summary
- Single-leader is simple; multi-leader and leaderless give more write availability but need conflict handling.
- Failover promotes a healthy copy when the active one fails.
- Replication does not replace backups, because mistakes get copied too.
- RPO is how much data you can lose; RTO is how long you can be down.
- Multi-region survives regional outages but adds latency and cost.
Architecture Diagram
A standby region takes over if the primary region fails.
- 1Users are routed to the primary region.
- 2Changes are copied to the standby region.
- 3If the primary fails, the replica is promoted.
- 4DNS sends users to the standby region.
Common Interview Questions
Chapter quiz
Redundancy and Replication · 5 questions
1.What is a single point of failure?
2.Which replication style may lose the latest writes if the main copy fails?
3.What is replication lag?
4.A developer accidentally deletes a table. What protects you?
5.RTO measures:
0 of 5 answered
Finished this lesson?
0 of 91 lessons done · 0% of the course

