For this recipe, we will need two PostgreSQL servers, pg1 and pg2, where pg1 is the currently active node. Follow these steps as the root user on the system indicated to move an active PostgreSQL service from one node to another:
- Stop the PostgreSQL service with pg_ctl on pg1:
pg_ctl -D /db/pgdata stop -m fast
- Unmount the /db filesystem on pg1:
umount /db
- Mark the VG_POSTGRES group as inactive using vgchange on pg1:
vgchange -a n VG_POSTGRES
- Demote the DRBD status to secondary with drbdadm on pg1:
drbdadm secondary pg
- Promote the DRBD status to primary with drbdadm on pg2:
drbdadm primary pg
- Mark the VG_POSTGRES group as active using vgchange on pg2:
vgchange -a y VG_POSTGRES
- Mount the /db filesystem ...