Set up Patroni synchronous replication mode to prevent data loss on failover

domain: patroni · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In patroni.yml add synchronous_mode: true under the bootstrap.dcs section; Patroni will automatically designate one synchronous standby and update PostgreSQL's synchronous_standby_names
  2. Set synchronous_mode_strict: false initially so that if no synchronous standby is available the primary can still accept writes; use true only if your RPO requires zero data loss at the cost of availability
  3. Verify synchronous replication is active: on the primary check pg_stat_replication — the sync_state column should show sync for the designated standby
  4. Test failover by stopping the primary node; Patroni should promote the synchronous standby; confirm with patronictl list that the new leader is the former synchronous standby
  5. After promotion, Patroni automatically selects a new synchronous standby from remaining replicas and updates synchronous_standby_names; monitor the transition with patronictl history
  6. Tune maximum_lag_on_failover alongside synchronous_mode so that asynchronous replicas with significant lag are not promoted accidentally if the synchronous standby is also unavailable

Known gotchas

Related routes

Perform a PostgreSQL physical streaming replication failover with Patroni
patroni · 6 steps · unrated
Configure MySQL GTID-based replication and perform a failover
mysql · 6 steps · unrated
Perform a planned Postgres leader change with patronictl switchover instead of triggering a failover
patroni.readthedocs.io · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans