There's more...

Though we provided our own PostgreSQL control script, the resource-agents repository package installed with Pacemaker contains a resource agent specifically designed for PostgreSQL. However, its usage is far more complicated. It can also monitor PostgreSQL by querying it, instead of simply using a process ID test. If you want to use this agent instead, follow these steps as root:

  1. Set the path of pg_ctl with this command:
        CTL=$(pg_config --bindir)/pg_ctl
  1. Add the pgsql resource agent as a primary with this command:
        crm configure primitive pg_agent ocf:heartbeat:pgsql \
            params pgctl="$CTL" \
                   pgdata="/db/pgdata" \
             op monitor interval="30" timeout="60" \
             op start interval="0" timeout="60" \
     op stop interval="0" timeout="60" ...

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.