The Distributed Replicated Block Device (DRBD) is a replicated storage solution for Linux. DRBD allows low-level storage block devices to be replicated and synchronized between two host machines, and, in the case of three-way replication, three host machines. In this learning activity, you will set up low-level storage and then use DRBD to replicate and synchronize that block device.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- (Both nodes) Import the GPG signing key and install the repository for `elrepo`.
On both nodes, import the signing key and install the repository.
- (Both nodes) Install the required packages for DRBD.
On each node, install the kernel module and utilities.
- (Both nodes) Load the DRBD kernel module.
Load the
drbd
kernel module.- (Both nodes) Start and enable the DRBD service.
Start the service and then enable the service.
- (Both nodes) Create a 500 megabyte logical volume named `lv-drbd` with a volume group named `vg-drbd` from the `/dev/xvdg disk`.
Create the physical volume, the volume group, and the logical volume.
- (Both nodes) Set protocol C in global config file.
Set replication mode to synchronous in
global_common.conf
and addprotocol C
to the net section. After that, we’ll create the resource configuration file fordrbd1
. The resource isdrbd1
, the device is/dev/drbd1
, disk is/dev/vg-drbd/lv-drbd
, meta-disk is internal, and each node listens on7790
.- (Both nodes) Create the device metadata for `drbd1`.
Use
drbdadm
to create device metadata.- (Both nodes) Start up the DRBD device.
Use
drbdadm
to start up the device.- Set the DRBD device on `drbd-server1` to be the primary.
Use the
drbdadm primary
command to setdrbd1
ondrbd-server1
to primary.- On `drbd-server1`, create an `ext4` file system on the DRBD device and mount it on `/mnt/hr`.
Create the
ext4
file system and mount/dev/drbd1
on/mnt/hr
.