Disk Replication with DRBD

From Alpine Linux
This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Larena on 4 Oct 2021.)

Disk Replication with DRBD

 #apk add drbd

Load DRBD kernel driver:

 #modprobe drbd

Sample DRBD configuration in /etc/drbd.d/r0.res (resource 0):

 resource r0 {
   device /dev/drbd1;
   disk /dev/md0;
   meta-disk internal;
   on host1 {
     address	192.168.0.1:7789;
   }
   on host2 {
     address	192.168.0.2:7789;
   }
 }


It is recommended to have a dedicated heartbeat interface for DRBD where replication occurs.

Create the DRBD device and bring it up on both nodes:

 #drbdadm create-md r0
 #drbdadm up r0

On primary node start replication:

 #drbdadm -- --overwrite-data-of-peer primary r0

If you want to temporarily speed up replication, run (e.g. 1G):

 #drbdsetup /dev/drbd1 syncer -r 1G

Control replication status:

 #cat /proc/drbd