Skip to content
SQL-Mac

Postgres Failovers

24th May 2018
DBA & SQL
postgres
postgresql
failover
high availability
sql server
Last updated:18th April 2026
3 Minutes

This week threw me a curveball — a request to troubleshoot a failed failover on a Postgres cluster. Fun, right? Especially since Postgres is a whole new world to me. Why not embrace the challenge and grow my skill set? With the dev handing me a username and password, I dived headfirst into unraveling the failover mystery.

Note: This post reflects PostgreSQL ~10/11 era behavior (2018). Tools like Patroni, repmgr, and pg_auto_failover have significantly matured since then and automate much of what was manual at the time.

The Journey Begins

First hurdle: a classic case of mixed signals. Armed with login credentials, I fired up PgAdmin thinking I was all set. Spoiler alert: I was dead wrong. The username and password were for a Linux account with zero sudo powers. A merry-go-round of confusion later, I finally got my hands on the right keys.

Next, I created my own user in Postgres and tweaked some conf files to get myself into the system via PgAdmin on my laptop. Hours of Google-fu and access tug-of-wars later, I was in. Navigating the Postgres landscape wasn’t rocket science. It’s kind of like RDBMS déjà vu, just with a new twist.

The Failover Tango

Now, brace yourself for the plot twist. In SQL Server land, failing over an Availability Group is relatively polished — use the wizard, dbatools, or run some T-SQL. The tooling abstracts most of the complexity.

In Postgres (at least at this point in time), shifting the primary role is a more manual process. You say goodbye to the primary node and promote the standby server to master — either via manual intervention or a trigger file that signals the standby to take over. When the original primary comes back online, it rejoins as a standby rather than automatically reclaiming the primary role. With pg_rewind, that process can be smoother, but it requires setup and configuration upfront.

The good news: tools like Patroni, repmgr, and pg_auto_failover handle much of this automatically now, bringing Postgres high availability closer to the SQL Server AG experience in terms of automation. If you’re setting up Postgres HA today, start with one of those rather than rolling it manually.

Key Takeaways

  • Postgres credentials can exist at the Linux OS level or the database level — don’t assume one grants the other.
  • Traditional Postgres streaming replication failover is more manual than SQL Server AG; promotion doesn’t happen automatically without additional tooling.
  • For modern Postgres HA, look at Patroni, repmgr, or pg_auto_failover — they automate the failover logic and make the process far more manageable.
  • Coming from SQL Server, the concepts are familiar (primary, standby, promotion); the tooling is just different.

This article, Postgres Failovers, was written by sqlmac and first published on 24th May 2018. Original link: https://sqlmac.com/blog/postgres-failovers.