| 1 |
=== Enabling dual-primary mode |
| 2 |
|
| 3 |
Dual-primary mode allows a resource to assume the primary role |
| 4 |
simultaneously on more than one node. Doing so is possible on either a |
| 5 |
permanent or a temporary basis. |
| 6 |
|
| 7 |
[NOTE] |
| 8 |
=============================== |
| 9 |
Dual-primary mode requires that the resource is configured to |
| 10 |
replicate synchronously (protocol C). Because of this it is latency |
| 11 |
sensitive, and ill suited for WAN environments. |
| 12 |
|
| 13 |
Additionally, as both resources are always primary, any interruption in the |
| 14 |
network between nodes will result in a split-brain. |
| 15 |
=============================== |
| 16 |
|
| 17 |
WARNING: In DRBD 9.0.x Dual-Primary mode is limited to exactly 2 Primaries for the use in live migration. |
| 18 |
|
| 19 |
[[s-enable-dual-primary-permanent]] |
| 20 |
==== Permanent dual-primary mode |
| 21 |
|
| 22 |
indexterm:[multiple primaries]indexterm:[dual-primary mode]To enable dual-primary mode, set the |
| 23 |
`allow-two-primaries` option to `yes` in the `net` section of your |
| 24 |
resource configuration: |
| 25 |
|
| 26 |
[source,drbd] |
| 27 |
---------------------------- |
| 28 |
resource <resource> |
| 29 |
net { |
| 30 |
protocol C; |
| 31 |
allow-two-primaries yes; |
| 32 |
fencing resource-and-stonith; |
| 33 |
} |
| 34 |
handlers { |
| 35 |
fence-peer "..."; |
| 36 |
unfence-peer "..."; |
| 37 |
} |
| 38 |
... |
| 39 |
} |
| 40 |
---------------------------- |
| 41 |
|
| 42 |
After that, do not forget to synchronize the configuration between nodes. Run |
| 43 |
`drbdadm adjust _<resource>_` on both nodes. |
| 44 |
|
| 45 |
You can now change both nodes to role primary at the same time with |
| 46 |
`drbdadm primary _<resource>_`. |
| 47 |
|
| 48 |
CAUTION: You should always implement suitable fencing policies. |
| 49 |
Using 'allow-two-primaries' without fencing is a very bad idea, |
| 50 |
even worse than using single-primary without fencing. |
| 51 |
|
| 52 |
[[s-enable-dual-primary-temporary]] |
| 53 |
==== Temporary dual-primary mode |
| 54 |
|
| 55 |
To temporarily enable dual-primary mode for a resource normally |
| 56 |
running in a single-primary configuration, issue the following |
| 57 |
command: |
| 58 |
|
| 59 |
---------------------------- |
| 60 |
# drbdadm net-options --protocol=C --allow-two-primaries <resource> |
| 61 |
---------------------------- |
| 62 |
|
| 63 |
To end temporary dual-primary mode, run the same command as above but with |
| 64 |
`--allow-two-primaries=no` (and your desired replication protocol, if |
| 65 |
applicable). |
| 66 |
|