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 |
---|---|
Dual-primary mode requires that the resource is configured to replicate synchronously (protocol C). |
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>
.
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).
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 |
---|---|
The |