00 /What You Will Learn
- Design active-passive multi-region database architectures for disaster recovery.
- Measure the performance impact of local primary commits versus simulated cross-region WAN replication.
- Quantify Recovery Time Objective (RTO) and Recovery Point Objective (RPO) timings during a simulated outage on your machine.
- Reproduce the negative control: split-brain dual-master corruption when failing over without fencing tokens.
- Execute automated failover: promoting the secondary database and fencing the failed primary in router state.
- Resume active write traffic on the promoted secondary region.
- Reintegrate the recovered primary as a demoted follower without split-brain divergences.
In this lab, two independent PostgreSQL containers run as Region 1 and Region 2. Cross-region replication, the 60 ms WAN lag, and standby promotion are simulated by the Python traffic router. It teaches failover protocols and fencing tokens, not PostgreSQL physical streaming replication.
Before you start
Finish Lab 23 (PostgreSQL Replication Lag) and Lab 12 (Timeouts and Retries with Toxiproxy) first. You should understand replication lag and network partitions. Note: Lab 23 uses real PostgreSQL streaming replication; this lab simulates cross-region replication at the application layer to focus on failover and fencing logic. Docker Desktop must be running.