6.8. Enabling dual-primary mode

Dual-primary mode allows a resource to assume the primary role simultaneously on both nodes. Doing so is possible on either a permanent or a temporary basis.

[Note]Note

Dual-primary mode requires that the resource is configured to replicate synchronously (protocol C).

6.8.1. Permanent dual-primary mode

To enable dual-primary mode, set the allow-two-primaries option to yes in the net section of your resource configuration:

resource <resource>
  net {
    protocol C;
    allow-two-primaries yes;
  }
  ...
}

After that, do not forget to synchronize the configuration between nodes. Run drbdadm adjust <resource> on both nodes.

You can now change both nodes to role primary at the same time with drbdadm primary <resource>.

6.8.2. Temporary dual-primary mode

To temporarily enable dual-primary mode for a resource normally running in a single-primary configuration, issue the following command:

# drbdadm net-options --protocol=C --allow-two-primaries <resource>

To end temporary dual-primary mode, run the same command as above but with --allow-two-primaries=no (and your desired replication protocol, if applicable).

6.8.3. Automating promotion on system startup

When a resource is configured to support dual-primary mode, it may also be desirable to automatically switch the resource into the primary role upon system (or DRBD) startup.

resource <resource>
  startup {
    become-primary-on both;
  }
  ...
}

The /etc/init.d/drbd system init script parses this option on startup and promotes resources accordingly.

[Note]Note

The become-primary-on approach is not required, nor recommended, in Pacemaker-managed DRBD configurations. In Pacemaker configuration, resource promotion and demotion should always be handled by the cluster manager.