Skip to content
StackDecode
System Design
5. Advanced Database ArchitectureAnimated

Database Failover

Switching to a standby when the primary fails.

The idea

A monitor detects the failure and promotes a replica, redirecting clients.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

AppPrimaryReplicaMonitorwrites
  • current message
  • earlier
  • failure or attack

Normally all writes go to the primary.

step:
1/6
from:
App
to:
Primary
1/6

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Detect primary failure
  2. 2Choose the most up-to-date replica
  3. 3Promote it
  4. 4Redirect clients

Where it is used

High availability.

Watch out for

Split brain and lost writes if not fenced.

Related