How it works...

We've made use of crm_mon before. It's an easy way to view the current status of all Pacemaker cluster resources. By starting this on pg2, we can watch what happens when pg1 shuts down. Unfortunately, simple reboots are too safe. The server will call the Pacemaker shutdown script, which will cause it to migrate to pg2 like it did in the previous recipe.

By calling pkill with the -9 argument on the corosync service, Pacemaker can no longer interfere. The Linux kernel will end the corosync process, negating any safeguards that Pacemaker might try to impose when pg1 reboots. Once we reboot pg1, we should return to pg2 in order to watch the output of crm_mon.

The final result should look something like this:

Note that pg1 shows ...

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.