The Pacemaker based MySQL server requires a DRBD resource from
which it mounts the /var/lib/mysql
directory. In this example,
the DRBD resource is simply named mysql
:
mysql
DRBD resource configuration (/etc/drbd.d/mysql.res
).
resource mysql { device minor 0; disk "/dev/data/mysql"; meta-disk internal; on node1 { address ipv4 10.0.42.100:7700; } on node2 { address ipv4 10.0.42.254:7700; } }
This resource uses an underlying local disk (in DRBD terminology, a
backing device) named /dev/data/mysql
on both cluster nodes,
node1
and node2
. Normally, this would be an LVM Logical Volume
specifically set aside for this purpose. The DRBD meta-disk
is
internal
, meaning DRBD-specific metadata is being stored at the end
of the disk
device itself. The device is configured to communicate
between IPv4 addresses 10.0.42.100 and 10.0.42.254, using TCP port
7700. Once enabled, it will map to a local DRBD block device with the
device minor number 0, that is, /dev/drbd0
.
Enabling a DRBD resource is explained in detail in the DRBD User’s Guide. In brief, the proper sequence of commands is this:
drbdadm create-md mysql drbdadm up mysql drbdadm -- --force primary mysql
Initializes DRBD metadata and writes the initial set of metadata
to | |
Creates the | |
Kicks off the initial device synchronization, and puts the device
into the |