There's more...

There's one final way to force a migration, and it's one we actually suggest for almost all cases. One of the arguments we can pass to crm node is the desired state of the node. Instead of killing the corosync service and rebooting pg1, we could run this command:

crm node standby pg1

This tells Pacemaker that pg1 should no longer be considered a valid target for resources. Again, this causes Pacemaker to migrate PGServer and any dependencies over to pg2. No matter what the state of Pacemaker is, pg1 will always be listed as Standby in the cluster by crm status.

This is an easy way to perform maintenance that might require multiple reboots or other potentially disruptive changes. To bring pg1 online once again, we would use ...

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.