Saturday, 2 June 2012

DRBD configuration steps


DRBD Installation

apt-get install drbd8-utils

To integrate between drbd version and userland version do the following:

apt-get install git-core git-buildpackage fakeroot debconf-utils docbook-xml docbook-xsl dpatch xsltproc autoconf flex

Build the package:

mkdir drbd
cd drbd
git clone http://git.drbd.org/drbd-8.3.git
cd drbd-8.3
git checkout drbd-8.3.10
dpkg-buildpackage -rfakeroot -b -uc
cd ..
dpkg -i drbd8-utils_8.3.10-0_amd64.deb


DRBD N/W Sample Configuration
On NODE A

cat /etc/hostname
mprox

cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.220 mprox.example.com mprox pvelocalhost
192.168.1.221 sprox.example.com sprox

cat /etc/drbd.d/global_common.conf
global { usage-count no; }
common { syncer { rate 30M; } }
resource r0 {
protocol C;
startup {
wfc-timeout 15; # wfc-timeout can be dangerous (http://forum.proxmox.com/threads/3465-Is-it-safe-to-use-wfc-timeout-in-DRBD-configuration)
degr-wfc-timeout 60;
become-primary-on both;
}
net {
cram-hmac-alg sha1;
shared-secret "my-secret";
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
on mprox {http://192.168.1.4/redmine/attachments/17/PROXMOX%20WITH%20DRBD.jpeg
device /dev/drbd0;
disk /dev/sdb1;
address 10.1.2.220:7788;
meta-disk internal;
}
on sprox {
device /dev/drbd0;
disk /dev/sdb1;
address 10.1.2.221:7788;
meta-disk internal;
}
}

On NODE B

cat /etc/hostname
sprox

cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.221 sprox.example.com sprox pvelocalhost
192.168.1.220 mprox.example.com mprox

cat /etc/drbd.d/global_common.conf
global { usage-count no; }
common { syncer { rate 30M; } }
resource r0 {
        protocol C;
        startup {
                wfc-timeout  15;    
                degr-wfc-timeout 60;
                become-primary-on both;
        }
        net {
                cram-hmac-alg sha1;
                shared-secret "my-secret";
                allow-two-primaries;
                after-sb-0pri discard-zero-changes;
                after-sb-1pri discard-secondary;
                after-sb-2pri disconnect;
        }
        on mprox {
                device /dev/drbd0;
                disk /dev/sdb1;
                address 10.1.2.220:7788;
                meta-disk internal;
        }
        on sprox {
                device /dev/drbd0;
                disk /dev/sdb1;
                address 10.1.2.221:7788;
                meta-disk internal;
        }
}

DRBD Splitbrain Recovery
Assume that "meta" is one of the drbd resources name

"Execute following commands on Node Failed"

drbdadm disconnect meta
drbdadm secondary meta
drbdadm -- --discard-my-data connect meta

"Execute following commands on Node NOT Failed"

drbdadm connect meta

Watch the drbd status
watch cat /proc/drbd

No comments:

Post a Comment