A three-node setup involves one DRBD device “stacked” atop another.
The following considerations apply to this type of setup:
The stacked device is the active one. Assume you have configured
one DRBD device /dev/drbd0, and the
stacked device atop it is /dev/drbd10,
then /dev/drbd10 will be the device
that you mount and use.
Device meta data will be stored twice, on the underlying DRBD device and the stacked DRBD device. On the stacked device, you must always use internal meta data. This means that the effectively available storage area on a stacked device is slightly smaller, compared to an unstacked device.
To get the stacked upper level device running, the underlying device must be in the primary role.
To be able to synchronize the backup node, the stacked device on the active node must be up and in the primary role.
In the following example, nodes are named
alice, bob, and
charlie, with alice and
bob forming a two-node cluster, and
charlie being the backup node.
resource r0 {
protocol C;
on alice {
device /dev/drbd0;
disk /dev/sda6;
address 10.0.0.1:7788;
meta-disk internal;
}
on bob {
device /dev/drbd0;
disk /dev/sda6;
address 10.0.0.2:7788;
meta-disk internal;
}
}
resource r0-U {
protocol A;
stacked-on-top-of r0 {
device /dev/drbd10;
address 192.168.42.1:7788;
}
on charlie {
device /dev/drbd10;
disk /dev/hda6;
address 192.168.42.2:7788; # Public IP of the backup node
meta-disk internal;
}
}As with any drbd.conf configuration
file, this must be distributed across all nodes in the cluster
— in this case, three nodes. Notice the following extra
keyword not found in an unstacked resource configuration:
stacked-on-top-of. This option informs DRBD that the resource which
contains it is a stacked resource. It replaces one of
the on sections normally found in any
resource configuration. Do not use
stacked-on-top-of in an lower-level
resource.
![]() | Note |
|---|---|
It is not a requirement to use Protocol A for stacked resources. You may select any of DRBD's replication protocols depending on your application. |
To enable a stacked resource, you first enable its lower-level resource and promote it:
drbdadm up r0drbdadm primary r0
As with unstacked resources, you must create DRBD meta data on the stacked resources. This is done using the following command:
drbdadm --stacked create-md r0-UThen, you may enable the stacked resource:
drbdadm --stacked up r0-Udrbdadm --stacked primary r0-U
After this, you may bring up the resource on the backup node, enabling three-node replication:
drbdadm create-md r0-Udrbdadm up r0-U
In order to automate stacked resource management, you may integrate stacked resources in your cluster manager configuration. See the section called “Using stacked DRBD resources in Pacemaker clusters” for information on doing this in a cluster managed by the Pacemaker cluster management framework.