Sub topic 14
Failback and restoring redundancy
This chapter assumes you know how failover works, how replication copies data between nodes, and what a health check is. Failover moves work to a healthy component. Failback is the step after it: returning to the intended steady state. Many outages get worse here, because the system runs without a spare until someone restores one.
Two jobs after failover
After a failover, the system is running on fewer copies than designed. Two separate jobs follow:
- Restore redundancy. Rebuild a spare so a second failure does not cause an outage.
- Fail back. Optionally move the primary role back to the original node.
The first job is almost always required. The second is a choice. If the new primary is healthy and equal in capacity, you can leave it as the primary and treat the repaired node as the new standby. Failing back is a second switch, and every switch carries risk.
Restoring redundancy
A repaired or replaced node is not ready to serve just because it is running. Its data is stale. It has to catch up first.
- Start the node as a standby, not as a primary.
- Resync its data. Replay the replication log from where it stopped, or copy a fresh snapshot if the gap is too large.
- Wait until replication lag is near zero.
- Pass health checks before it receives traffic or becomes eligible for promotion.
If the old primary was running asynchronous replication, it may hold writes that never reached the new primary. Those writes conflict with the new history. Most systems discard them by rebuilding the old node from the new primary. Save them for review first if they matter, because they are the data your RPO allowed you to lose.
Planning a failback
If you do fail back, treat it as a planned maintenance event, not an emergency. Do it deliberately:
- Choose a low-traffic window.
- Confirm the original node is fully in sync.
- Use the same controlled switch you use for failover, including fencing the node that gives up the role.
- Verify after the switch, then keep the old node as a healthy standby.
Automatic failback is risky. A node that flaps, failing and recovering repeatedly, would make traffic bounce between nodes. Prefer manual failback, or require the node to stay healthy for a long, fixed period before it takes the role back. This is the same speed versus false-positive trade-off you saw in failure detection, applied in the other direction.
Common errors
| Error | Result | Fix |
|---|---|---|
| Returning the old primary to traffic before it syncs | Users read stale data | Gate on lag and health checks |
| Letting the old primary resume writing | Split brain | Fence it and demote it first |
| Automatic failback with no delay | Traffic flaps between nodes | Require a stable period or manual approval |
| Forgetting to restore the spare | Next failure is an outage | Alert on reduced redundancy |
| Resyncing at full speed during peak load | The new primary slows down | Throttle the copy |
The last row matters in practice. A full resync reads heavily from the only healthy node, so throttle it and watch latency.
Monitoring redundancy
Track the number of healthy copies, not only whether the service is up. A service running on one of three nodes looks healthy from outside. Alert when the healthy count drops below the design target, and treat that alert as an incident until it clears.
Exercise
A primary database fails and its standby is promoted. Two hours later the old primary is repaired. List the steps you take before it can serve traffic again, and explain why you might not promote it back to primary.
Show answer
Start it as a standby, demote and fence it so it cannot accept writes, resync from the new primary (discarding or saving any unreplicated writes), wait for lag near zero and passing health checks, then add it as a standby. Failing back is a second switch with its own risk, so if the current primary is healthy and has equal capacity, leave it in place. If you do fail back, do it as a planned switch in a quiet window.