How it works...

Finally, an easy recipe! Our first (and really only) step is to stop PostgreSQL on the primary node. Our second step is to watch the aftermath. One quick call to systemctl to stop PostgreSQL, and we want to watch the other two nodes to see the state of the cluster change, and how it happens.

The first of these observations is on the standby node, which will presumably be promoted. We set the log location to /var/log/postgresql/repmgr.log in the Installing and configuring repmgr recipe. This allows us to watch the log as the repmgr daemon begins to perform the failover process.

The first thing that happens is that pgha2 loses contact with pgha1 and begins a series of checks to verify that this wasn't an errant reading. We can ...

Get PostgreSQL 12 High Availability Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.