=== Install OCFS2 + DRBD8 onto Ubuntu 9.04 64Bit OS === hostname eth0 eth1 ocfs21 216.69.70.71 10.0.0.71 ocfs22 216.69.70.72 10.0.0.72 == on GFS1 and GFS2 > vim /etc/hosts 10.0.0.71 ocfs21 10.0.0.72 ocfs22 = install DRBD8 from source > aptitude install drbd8-utils > aptitude install build-essential autoconf automake libtool flex libncurses-dev linux-source > aptitude install linux-source-2.6.28 > cd /usr/src/ > tar jxvf linux-source-2.6.28.tar.bz2 > cd linux-source-2.6.28 > make mrproper > cp /boot/config-2.6.28-13-server /usr/src/linux-source-2.6.28/.config > make menuconfig exit > make prepare > wget http://oss.linbit.com/drbd/8.3/drbd-8.3.1.tar.gz > tar xf drbd-8.3.1.tar.gz > cd drbd-8.3.1 > make KDIR=/usr/src/linux-source-2.6.28 > make install > mv /lib/modules/2.6.28.9/kernel/drivers/block/drbd.ko /lib/modules/2.6.28-13-server/kernel/drivers/block/ > modprobe drbd > echo 'drbd' >> /etc/modules > update-rc.d drbd defaults > lsmod | grep drbd = Edit drbd.conf > vim /etc/drbd.conf global { usage-count yes; } common { syncer { rate 100M; al-extents 257; } } resource r0 { protocol C; startup { become-primary-on both; ### For Primary/Primary ### degr-wfc-timeout 60; wfc-timeout 30; } disk { on-io-error detach; } net { allow-two-primaries; ### For Primary/Primary ### cram-hmac-alg sha1; shared-secret "FooFunFactory"; after-sb-0pri discard-zero-changes; after-sb-1pri violently-as0p; after-sb-2pri violently-as0p; } on ocfs1 { device /dev/drbd0; disk /dev/sda4; address 10.0.0.71:7788; meta-disk /dev/sda3[0]; } on ocfs2 { device /dev/drbd0; disk /dev/sda4; address 10.0.0.71:7788; meta-disk /dev/sda3[0]; } } =Create Metadata > dd if=/dev/zero of=/dev/sda3 bs=1M count=256 > drbdadm create-md r0 > /etc/init.d/drbd stop > /etc/init.d/drbd start =Make them Primary/Primary > drbdsetup /dev/drbd0 primary -o > cat /proc/drbd version: 8.3.0 (api:88/proto:86-89) GIT-hash: 9ba8b93e24d842f0dd3fb1f9b90e8348ddb95829 build by ivoks@ubuntu, 2009-01-17 07:49:56 0: cs:Connected ro:Primary/Primary ds:UpToDate/Diskless C r--- ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:4883760 # install ocfs2 > aptitude install ocfs2-toolsf #ubuntu 1 > cat /etc/hosts 10.0.0.71 ocfs21 10.0.0.72 ocfs21 > cat /etc/hostname ocfs21 > hostname ocfs21 #ubuntu 2 > cat /etc/hosts 10.0.0.71 ocfs21 10.0.0.72 ocfs21 > cat /etc/hostname ocfs22 > hostname ocfs22 > vim /etc/default/o2cb #O2CB_ENABLED=false O2CB_ENABLED=true > mkdir /etc/ocfs2/ > cp /usr/share/doc/ocfs2-tools/examples/cluster.conf /etc/ocfs2/ node: ip_port = 7777 ip_address = 10.0.0.71 number = 0 name = ocfs21 cluster = ocfs2 node: ip_port = 7777 ip_address = 10.0.0.72 number = 1 name = ocfs22 cluster = ocfs22 cluster: node_count = 2 name = ocfs2 > /etc/init.d/o2cb restart > mkfs.ocfs2 /dev/sda3 > mkfs.ocfs2 /dev/sda4 > /etc/init.d/drbd restart > mount -t ocfs2 /dev/drbd0 /data > mounted.ocfs2 -f > vim /etc/rc.local sleep 5 mount /dev/drbd0 /data == OCFS2 check = GFS1 > i=0;while true; do echo aaaaaaaa,$i >> test.log ;i=`expr $i + 1`;done > tail -f test.log = GFS2 > i=0;while true; do echo bbbbbbbb,$i >> test.log ;i=`expr $i + 1`;done > tail -f test.log = If Split brian happen and did not sysnc. #host 1 (main side) > drbdadm connect resource #host 2 (adjust side) >umount /data >drbdadm secondary resource >drbdadm -- --discard-my-data connect resource >drbdsetup /dev/drbd0 primary -o