DRBD

From VVCWiki
Jump to navigationJump to search
  • install modules
yum install drbd83 kmod-drbd8-xen
  • adjust ethernet interface settings (opional)

Some ethernet interfaces require this for drbd to work properly

/sbin/ifup-local
#!/bin/sh
dev=$1
if [ ${dev}x = eth0x ] ; then
/sbin/ethtool -K eth0 tx off
fi
  • create /etc/drbd.conf
global {
  usage-count no;
}
common {
  protocol C;
  startup {
    wfc-timeout 15;
  }
  syncer { 
    rate 50M;
    verify-alg sha1;
  }
# Fencing only works with pacemaker
  disk {
    on-io-error detach;
    fencing resource-only;
  }
  net {
    after-sb-0pri discard-zero-changes;
  }
  handlers {
        split-brain "/usr/lib/drbd/notify-split-brain.sh root";
        out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";
        fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
        after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh"; 
  }
}
resource u00 {
  on c20.chepkov.lan {
    device    /dev/drbd0;
    disk      /dev/xvda2;
    address   10.10.10.20:7789;
    flexible-meta-disk internal;
  }
  on c21.chepkov.lan {
    device    /dev/drbd0;
    disk      /dev/xvda2;
    address   10.10.10.21:7789;
    flexible-meta-disk internal;
  }
}
  • zero partition
dd if=/dev/zero of=/dev/xvda2 bs=1M count=1
sync
  • create device
drbdadm create-md u00
  • load driver
modprobe -s drbd `drbdadm sh-mod-parms`
  • create device node
drbdadm up u00
  • create new array
    • fast on clean disks
drbdadm -- --clear-bitmap new-current-uuid u00
  • slow on disks used before
drbdadm -- --overwrite-data-of-peer primary u00
  • make it primary on one node
drbdadm primary u00
  • create filesystem
mkfs -j /dev/drbd0
  • update fs parameters
tune2fs -e continue -i 0 -c 0 /dev/drbd0