How to do it...

For this recipe, we should already have three PostgreSQL servers. As usual, we'll assume they are named pg1, pg2, and pg3. If pg1 is the current primary, follow these steps to promote a different node to primary status:

  1. Execute the following command as the postgres user to initiate a failover:
        patronictl failover -d pg1:2379 stampede
  1. Answer the presented prompts as directed.
  2. Wait a few seconds before running this command as the postgres user:
        patronictl list -d pg1:2379 stampede

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.