SETTING UP DRBD

tested on Slackware64 14.2

INSTALL

eventually build drbd from scratch

SETUP

all nodes

#rm -rf /etc/drbd.d/
#rm -f /etc/drbd.conf

storage1

cat > /etc/drbd.conf <<EOF
global {
        usage-count yes;
        udev-always-use-vnr;
}

common {
        net {
                protocol C;
                fencing resource-only;
                allow-two-primaries yes;
        }
        disk {
                read-balancing when-congested-remote;
        }
}

resource r1 {
        device    /dev/drbd1;
        meta-disk internal;

        on storage1 {
                disk      /dev/sda2;
                address   10.1.1.221:7701;
        }
        on storage2 {
                disk      /dev/sda3;
                address   10.1.1.222:7701;
        }
}

resource r2 {
        device    /dev/drbd2;
        meta-disk internal;

        on storage2 {
                disk      /dev/sda2;
                address   10.1.1.222:7702;
        }
        on storage3 {
                disk      /dev/sda3;
                address   10.1.1.223:7702;
        }
}

resource r3 {
        device    /dev/drbd3;
        meta-disk internal;

        on storage3 {
                disk      /dev/sda2;
                address   10.1.1.223:7703;
        }
        on storage1 {
                disk      /dev/sda3;
                address   10.1.1.221:7703;
        }
}
EOF

scp /etc/drbd.conf storage2:/etc/
scp /etc/drbd.conf storage3:/etc/

FIRST SHOT (--force) & ACTIVE/PASSIVE

all nodes

lsmod | egrep 'drbd|lru_cache'
rmmod lru_cache
rmmod drbd_transport_tcp
rmmod drbd

modprobe drbd
modprobe drbd_transport_tcp

drbdadm down all
drbdadm create-md all
drbdadm up all

storage1

ls -lF /dev/drbd1
ls -lF /dev/drbd3
drbdadm primary --force r1
drbdadm secondary r3
drbdadm status

storage2

ls -lF /dev/drbd1
ls -lF /dev/drbd2
drbdadm primary --force r2
drbdadm secondary r1
drbdadm status

storage3

ls -lF /dev/drbd2
ls -lF /dev/drbd3
drbdadm status
drbdadm primary --force r3
drbdadm secondary r2

on any node

once the volume is synchronized, see the difference in size,

fdisk -l /dev/sda2 /dev/drbd1

for a 10GB partition as sda2, it takes exactly and reproducible 364544 bytes difference.

ENABLE AT STARTUP

cat >> /etc/rc.d/rc.local <<-EOF
/sbin/modprobe drbd
/sbin/modprobe drbd_transport_tcp
/bin/lsmod | grep drbd
/usr/local/sbin/drbdadm up all
/usr/local/sbin/drbdadm status
EOF
vi /etc/rc.d/rc.local

OPERATIONS

see operations

MONITORING

output something only if there is a problem to report,

mkdir -p /root/bin/
vi /root/bin/check.drbd.ksh

#!/bin/ksh
tmp=`/usr/local/sbin/drbdadm status | grep '^  disk:' | grep -v '^  disk:UpToDate$'`
[[ -n $tmp ]] && /usr/sbin/drbdadm status
unset tmp

chmod +x /root/bin/check.drbd.ksh

test,

/root/bin/check.drbd.ksh

and enable,

crontab -e

*/5 * * * * /root/bin/check.drbd.ksh

…assuming you got /etc/aliases alright.

TODO

does net {fencing resource-only;} do anything if I do not set handlers {fence-peer somecommand;}?

drbd-utils/scripts/stonith_admin-fence-peer.sh https://github.com/LINBIT/drbd-utils/blob/master/scripts/stonith_admin-fence-peer.sh

[DRBD-user] Trying to Understanding crm-fence-peer.sh https://lists.linbit.com/pipermail/drbd-user/2019-January/024759.html

RESOURCES

LINBIT DRBD kernel module https://github.com/LINBIT/drbd

DRBD userspace utilities (for 9.0, 8.4, 8.3) https://github.com/LINBIT/drbd-utils

“read-balancing” with 8.4.1+ https://www.linbit.com/en/read-balancing/

v9

DRBD 9.0 Manual Pages https://docs.linbit.com/man/v9/

drbd.conf - DRBD Configuration Files https://docs.linbit.com/man/v9/drbd-conf-5/

v8.4

DRBD 8.4 https://github.com/LINBIT/drbd-8.4

drbd.conf - Configuration file for DRBD’s devices https://docs.linbit.com/man/v84/drbd-conf-5/

more

LINSTOR SDS server https://github.com/LINBIT/linstor-server

ops

CLI management tool for DRBD. Like top, but for DRBD resources. https://github.com/LINBIT/drbdtop

troubles

[DRBD-user] drbd-dkms fails to build under proxmox 6 https://lists.linbit.com/pipermail/drbd-user/2019-August/025208.html

[DRBD-user] Problems compiling kernel module https://lists.linbit.com/pipermail/drbd-user/2016-June/022391.html


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml