How to do it...

For this recipe, we should already have three PostgreSQL servers. As before, we'll assume they are named pg1, pg2, and pg3. Follow these steps to fix the broken system:

  1. Remove the contents of the corrupt cluster by running the following command as the postgres user on the broken system:
        rm -Rf /db/pgdata
  1. Start a new patroni daemon with this command as the postgres user:
        patroni /etc/patroni/stampede.yml \
            &> /var/log/postgresql/patroni.log &
  1. Follow the Patroni log with this command:
        tail -f /var/log/postgresql/patroni.log

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.