DRBD Installation

From Wiki
Revision as of 20:42, 15 April 2011 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


To set up DRBD services follow these steps. This needs to be done on both nodes.

  • Uncomment the system extras section in /etc/yum.repos.d/yum.system.repo
  • Install DRBD packages.
yum -y install drbd83.x86_64 kmod-drbd83.x86_64

DRBD Configuration

DRBD can be used to replicate any block device. In this case we will be replicating /dev/sdb1 and using /dev/sda6 as the meta device.

Edit /etc/drbd.conf

# please have a a look at the example configuration file in
# /usr/share/doc/drbd83/drbd.conf

global { usage-count no; }
resource repdata {
  protocol C;
  startup {
        wfc-timeout 0;
        degr-wfc-timeout     120;
  disk { on-io-error detach; } # or panic, ...
  net { 
        cram-hmac-alg "sha1";
        shared-secret "NoawEcKibr7";
        after-sb-0pri discard-zero-changes;
        after-sb-1pri discard-secondary;
        after-sb-2pri disconnect;
  } # don't forget to choose a secret for auth !
  syncer { rate 30M; }
  on drbdtest1.watters.ws {
    device /dev/drbd0;
    disk /dev/sdb1;
    meta-disk /dev/sda6[0];
  on drbdtest2.watters.ws {
    device /dev/drbd0;
    disk /dev/sdb1;
    meta-disk /dev/sda6[0];
  • scp /etc/drbd.conf over to the secondary node.
scp /etc/drbd.conf
  • Initialize DRBD metadata on both nodes.
drbdadm create-md repdata
Note: You may need to zero out the meta device using dd in order to do this. BE CAREFUL WITH THIS COMMAND.
dd if=/dev/zero of=/dev/sda6 bs=1M count=10
  • Start DRBD service on both nodes.
/etc/init.d/drbd start
  • Set one of the servers to be the primary device
drbdsetup /dev/drbd0 primary -o
  • Check the status.
/etc/init.d/drbd status

LVM Configuration

  • Set /etc/lvm/lvm.conf to only look at the DRBD device by adding a filter.
filter = [ "a|drbd.*|", "r|.*|" ]
  • create and rescan devices
pvcreate /dev/drbd0

Firewall Update

DRBD uses port 7788 to keep data synchronized and for link detection. Add the following rule to /etc/sysconfig/iptables and restart iptables.

-A RH-Firewall-1-INPUT -i eth1 -m state --state NEW -m tcp -p tcp --dport 7788 -j ACCEPT

The interface should be set to whatever the DRBD private IP is on.

External Links