Performing a managed failover

Managing a Patroni cluster is relatively easy as long as it's operating normally. The primary reason for this is the provided patronictl command-line tool. Beyond simply displaying cluster status, it also manages several other helpful operations.

In particular, we can use it to force the primary node to step down and allow one of the replicas to take its place. In a high availability context, this is a great way to perform system upgrades. We merely need switch to another primary, upgrade the old system, and repeat. We're done when every node is the latest PostgreSQL version. During this process, the database is never offline. This procedure also works for regular system maintenance.

Let's see how to change the ...

Get PostgreSQL High Availability Cookbook - Second Edition 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.