Step 2. Now download drbd 8.3.9 which matches the kernel built-in module, unzip it, and prepare the installation on both servers
cd ../
wget http://oss.linbit.com/drbd/8.3/drbd-8.3.9.tar.gz
tar zxvf drbd-8.3.9.tar.gz
Now compile drbd (I need to enable pacemaker for heartbeat cluster purposes). See the following four screenshots please.
cd drbd-8.3.9/
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-utils --with-pacemaker
make KDIR=/usr/src/linux
make install
Now create the default /etc/drbd.conf configuration file, and this is my configuration file:
global {
usage-count no;
}
common {
syncer { rate 100M; }
protocol C;
}
resource postgres {
startup {
wfc-timeout 0;
degr-wfc-timeout
120;
}
disk { on-io-error detach; }
on drbd1 {
device /dev/drbd0;
disk /dev/sdb;
address 192.168.5.129:7791;
meta-disk internal;
}
on drbd2 {
device /dev/drbd0;
disk /dev/sdb;
address 192.168.5.137:7791;
meta-disk internal;
}
}
And here is the /etc/hosts file on drbd1:
192.168.5.137 drbd2.site drbd2 192.168.5.129 drbd1.site drbd1
Step 3. Copy /etc/drbd.conf and /etc/hosts from server drbd1 to server drbd2
scp /etc/hosts drbd2:/etc
scp /etc/drbd.conf drbd2:/etc
Step 4. Configure DRBD on both drbd1 and drbd2
drbdadm create-md postgres
modprobe drbd
drbdadm up postgres
Step 5. Now activate the primary node on either server, drbd1 or drbd2 (NOT BOTH), and I choose drbd2:
drbdadm -- --overwrite-data-of-peer primary postgres
You could check the initialization process on both servers with:
cat /proc/drbd
Step 6. Start drbd server on both servers
/etc/init.d/drbd start
Check drbd status on server drbd1 (secondary/primary):
And check drbd status on server drbd2 (primary/secondary):
Bingo, it works now. From this point you can go ahead and test drbd, mysql/postgresql active/passive server. There are tons of documentations online talking about this topic.
How To Upgrade DRBD Userland Version To 8.3.9 Under OpenSUSE 11.4 - Page 2