Why Failover Must Be Drilled Regularly, Not Only During Outages
Many teams have failover plans on paper but have never tested them in practice, and hidden assumptions only surface during a real outage. The author argues that failover is a code path rarely exercised, so bugs accumulate as the system changes, such as lagging replicas, stale connection pool DNS caches, and hardcoded hostnames. The recommended approach is scheduled planned switchovers, for example weekly during low-traffic hours, so that broken assumptions are found while engineers are alert. The setup described uses Patroni 3.x with etcd for leader election, and HAProxy routing traffic via Patroni's REST API endpoint /primary on port 8008. A key detail is the on-marked-down shutdown-sessions option, which prevents applications from holding connections to a demoted primary that would otherwise cause read-only transaction errors.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in