Simple drbd configuration

Each of the following steps must be completed on both nodes.

yum install kmod-drbd83 drbd83

fdisk -l /dev/sdb

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  83  Linux

vim /etc/drbd.conf

global {
        usage-count yes;
}

common {
        protocol C;
        syncer { rate 10M; }
}


resource r0 {
        on node1.ybn.fr {
                device    /dev/drbd1;
                disk      /dev/sdb1;
                address   192.168.0.10:7789;
                meta-disk internal;
        }
        on node2.ybn.fr {
                device    /dev/drbd1;
                disk      /dev/sdb1;
                address   192.168.0.11:7789;
                meta-disk internal;
        }
        startup {
                become-primary-on node1.ybn.fr;
        }
}
  • Synchronisation rate should be the third of effective available bandwidth . You can measure network troughtput this way.
  • The resource uses TCP port 7789 for its network connections, and binds to the IP addresses 192.168.0.1 and 192.168.0.11, respectively. You can configure firewall rules this way.
scp /etc/drbd.conf node2:/etc/drbd.conf

modprobe drbd

drbdadm create-md r0

drbdadm up r0

cat /proc/drbd

1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:1044124

The following must be performed on only one node, only on initial resource configuration, and only on the node you selected as the synchronization source.

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

drbd-overview

1:r0 SyncSource Primary/Secondary UpToDate/Inconsistent C r---- 
[=====>..............] sync'ed: 30.6% (726684/1044124)K

drbd-overview

1:r0  Connected Primary/Secondary UpToDate/UpToDate C r---- 

mkfs.ext3 /dev/drbd1

参考地址:http://www.ybn.fr/linux-technical-library/configure-netfilter-iptables-firewall/simple-drbd-configuration