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:
- Set the path of pg_ctl with this command:
CTL=$(pg_config --bindir)/pg_ctl
- 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" ...