How to do it...

Follow these instructions as the root user to repair a split-brain scenario:

  1. First, decide which node should be the new primary. This should be relatively easy, since some event likely precipitated the node mismatch. For the remainder of this recipe, we will assume pg2 should be the new primary node.
  2. Prepare each server by assuring that each is disconnected from the other:
        drbdadm disconnect pg
  1. Disable the VG_POSTGRES volume with vgchange on pg1:
        vgchange -a n VG_POSTGRES
  1. Use drbdadm to downgrade pg1 to secondary status:
        drbdadm secondary pg
  1. Execute this command on pg1 to connect while discarding metadata:
        drbdadm connect --discard-my-data pg
  1. Execute this command on pg2 to connect to DRBD:
        drbdadm connect ...

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.