How it works...

There is actually very little in this recipe that we have not done in this chapter. What we have actually done here is formalized the steps necessary to tear down and build up an active stack. We start the process by stopping the PostgreSQL service with pg_ctl, as we clearly can't move the data while it's still in use.

Next, we use umount to decouple the /dev/VG_POSTGRES/LV_DATA device from the /db directory. With no locks on the storage volume, we can use vgchange with the -a parameter set to n to deactivate any volume in the VG_POSTGRES group. Since the VG_POSTGRES group actually resides on the DRBD device, it can only be active on one node at a time.

Once the volumes are no longer active, we can set the DRBD status to ...

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.