Tag: DRBD
DRBD configuration with loop file
by Emre Tugriceri on Jul.18, 2012, under DRBD
dd if=/dev/zero of=disk1.raw bs=1073741824 count=20
1009 losetup -f disk1.raw
1010 losetup -a
1012 stat /dev/loop0
fdisk /dev/loop0
# rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
# vi /etc/yum.repos.d/elrepo.repo
enabled=0
# yum –enablerepo=elrepo install drbd83-utils kmod-drbd83
SRV1# cat /etc/drbd.conf
#
# please have a a look at the example configuration file in
# /usr/share/doc/drbd83/drbd.conf
#
global {
minor-count 1;
usage-count no; # Participate in DRBD’s online usage counter at http://usage.drbd.org
}
resource zenoss {
protocol C;
startup {
wfc-timeout 30;
degr-wfc-timeout 60;
}
disk {
on-io-error detach;
fencing resource-only;
}
handlers {
pri-on-incon-degr “echo o > /proc/sysrq-trigger ; halt -f”; # reboot the system after a connection fail
pri-lost-after-sb “echo o > /proc/sysrq-trigger ; halt -f”;
outdate-peer “/usr/lib/heartbeat/drbd-peer-outdater”;
}
net {
after-sb-0pri discard-least-changes; # Self healing if split brean
after-sb-1pri call-pri-lost-after-sb;
max-buffers 2048; # datablock buffers used before writing to disk.
ko-count 4; # Peer is dead if this count is exceeded.
}
syncer {
rate 12M;
al-extents 257;
}
on SRV1 {
device /dev/drbd0;
disk /dev/loop0;
address 192.168.1.1:7789;
meta-disk internal;
}
on SRV2 {
device /dev/drbd0;
disk /dev/loop0;
address 192.168.1.2:7789;
meta-disk internal;
}
}
SRV1# cat /proc/drbd
SRV1# drbdsetup /dev/drbd0 primary -o
SRV1# cat /proc/drbd
SRV1# mkfs -t ext3 /dev/drbd0
SRV1# mkdir /mnt/drbd
SRV1# mount /dev/drbd0 /mnt/drbd
SRV1# cp /var/log/maillog /mnt/drbd
SRV1# ls /mnt/drbd
SRV1# umount /mnt/drbd
SRV1# drbdadm secondary zenoss
SRV2# drbdadm primary zenoss
SRV2# mkdir /mnt/drbd
SRV2# mount /dev/drbd0 /mnt/drbd
SRV2# ls /mnt/drbd
