Problem:
You need to know if your DRBD and OCFS2 disk fault tolerance has been setup correctly but the configuration options are overwhelming.
Solution:
See the output below for a good working configuration of DRBD and OCFS2:
On server 1:
FSTAB:
/dev/drbd0 /var/www ocfs2 noauto,noatime 0 0
DRBD:
root@test1:~# cat /etc/drbd.conf
global { usage-count no; }
common { syncer { rate 1000M; } }
resource r0 {
protocol C;
startup {
become-primary-on both;
}
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
on test1 {
device /dev/drbd0;
disk /dev/sdb1;
address 41.206.194.126:7789;
meta-disk internal;
}
on test2 {
device /dev/drbd0;
disk /dev/sdb1;
address 41.206.194.125:7789;
meta-disk internal;
}
}
Server 1, OCFS2:
root@test1:~# cat /etc/ocfs2/cluster.conf
cluster:
node_count = 2
name = web
node:
ip_port = 7777
ip_address = 41.206.194.126
number = 1
name = test1
cluster = web
node:
ip_port = 7777
ip_address = 41.206.194.125
number = 2
name = test2
cluster = web
Server 2, FSTAB:
root@test2:~# cat /etc/fstab
/dev/drbd0 /var/www ocfs2 noauto,noatime 0 0
Server 2, DRBD:
root@test2:~# cat /etc/drbd.conf
global { usage-count no; }
common { syncer { rate 1000M; } }
resource r0 {
protocol C;
startup {
become-primary-on both;
}
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
on test1 {
device /dev/drbd0;
disk /dev/sdb1;
address 41.206.194.126:7789;
meta-disk internal;
}
on test2 {
device /dev/drbd0;
disk /dev/sdb1;
address 41.206.194.125:7789;
meta-disk internal;
}
}
Server 2, OCFS2:
root@test2:~# cat /etc/ocfs2/cluster.conf
cluster:
node_count = 2
name = web
node:
ip_port = 7777
ip_address = 41.206.194.126
number = 1
name = test1
cluster = web
node:
ip_port = 7777
ip_address = 41.206.194.125
number = 2
name = test2
cluster = web