DRBD

telepítés

apt-get install drbd8-utils

konfigurálás

vi /etc/drbd.d/r1.res
r1.res
#include "drbd.d/global_common.conf";
#include "drbd.d/*.res";
 
resource r1 {
 protocol A;
    # transfer protocol to use.
    # C: write IO is reported as completed, if we know it has
    #    reached _both_ local and remote DISK.
    #    * for critical transactional data.
    # B: write IO is reported as completed, if it has reached
    #    local DISK and remote buffer cache.
    #    * for most cases.
    # A: write IO is reported as completed, if it has reached
    #    local DISK and local tcp send buffer. (see also sndbuf-size)
    #    * for high latency networks
 startup { wfc-timeout 0; degr-wfc-timeout 120; }
 
#disk { on-io-error detach; }
 
 on rpi {
  device /dev/drbd0;
  disk /dev/loop0;
  flexible-meta-disk /dev/loop1;
  address 192.168.1.115:7788;
 }
 on rpi2 {
  device /dev/drbd0;
  disk /dev/loop0;
  flexible-meta-disk /dev/loop1;
  address 192.168.1.118:7788;
 }
}

A hoszt névnek (uname -n) egyeznie kell a konfigban lévő hoszt névvel. Szükség esetén a hosts fájlban definiáljuk. Ezután inícializáljuk mindkét szervert:

inícializálás

drbdadm create-md r1
modprobe drbd
drbdadm up r1
drbdadm attach r1
drbdadm syncer r1
drbdadm connect r1

indítás

Majd definiáljuk a Primary szerepkört a primary oldalon:

drbdadm -- --overwrite-data-of-peer primary r1

Itt nézhetjük, hol tart a szinkronizlás:

cat /proc/drbd

vagy

drbd-overview

szabályos leállítás

Leállítjuk a secondary oldalt:

service drbd stop

Majd a primary oldalon is secondary szerepkörre állunk és ott is leállítjuk a drbd-t.

drbdadm secondary r1
service drbd stop

Visszaindítás sorrendje: secondary, primary, majd primary-n kiadni

drbdadm primary r1