本方案中采用DRBD来即时同步两台NODE服务器中的存储设备的数据,然后用OCFS2来设置分布式共享文件系统,从而为后继部署双机热备和负载均衡建立底层数据的实现基础。
────────────────────────────────────────────────────────────────────────────────
Check your Linux if support ocfs2 or not
────────────────────────────────────────────────────────────────────────────────
# lsmod | grep ocfs
--------------------------------------------------------------------------------
ocfs2_dlmfs 18526 1
ocfs2_stack_o2cb 3564 0
ocfs2_dlm 212552 1 ocfs2_stack_o2cb
ocfs2_nodemanager 159579 11 ocfs2_dlmfs,ocfs2_stack_o2cb,ocfs2_dlm
ocfs2_stackglue 9821 2 ocfs2_dlmfs,ocfs2_stack_o2cb
configfs 23522 2 ocfs2_nodemanager
--------------------------------------------------------------------------------
注:如果无任何输出,说明您的内核还未支持OCFS2文件系统,您必须先安装相关支持,可参考下一步骤
Install UEK kernel (support ocfs2 directly).
────────────────────────────────────────────────────────────────────────────────
Install UEK kernel (support ocfs2 directly)
────────────────────────────────────────────────────────────────────────────────
Download UEK kernel:
http://public-yum.Oracle.com/repo/OracleLinux/OL6/UEK/
http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/i386/
# wget http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/i386/kernel-uek-firmware-2.6.39-200.29.2.el6uek.noarch.rpm
# wget http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/i386/kernel-uek-2.6.39-200.29.2.el6uek.i686.rpm
# wget http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/i386/kernel-uek-devel-2.6.39-200.29.2.el6uek.i686.rpm
# yum install dracut-kernel;
# rpm -ivh kernel-uek-firmware-2.6.39-200.29.2.el6uek.noarch.rpm;
# rpm -ivh kernel-uek-2.6.39-200.29.2.el6uek.i686.rpm;
# vi /boot/grub/grub.conf;
--------------------------------------------------------------------------------
default=0
--------------------------------------------------------------------------------
# reboot
# lsmod | grep ocfs
--------------------------------------------------------------------------------
ocfs2_dlmfs 18526 1
ocfs2_stack_o2cb 3564 0
ocfs2_dlm 212552 1 ocfs2_stack_o2cb
ocfs2_nodemanager 159579 11 ocfs2_dlmfs,ocfs2_stack_o2cb,ocfs2_dlm
ocfs2_stackglue 9821 2 ocfs2_dlmfs,ocfs2_stack_o2cb
configfs 23522 2 ocfs2_nodemanager
--------------------------------------------------------------------------------
────────────────────────────────────────────────────────────────────────────────
DRBD
────────────────────────────────────────────────────────────────────────────────
http://www.drbd.org/
http://www.drbd.org/download/mainline/
Starting with Linux 2.6.33,
DRBD is officially integrated into the vanilla Linux kernel source.
Linux releases with DRBD:
--------------------------------------------------------------------------------
Kernel-release DRBD-release
2.6.33 8.3.7
2.6.34 8.3.7
2.6.35 8.3.8
2.6.36 8.3.8.1
2.6.37 8.3.9
2.6.38 8.3.9
2.6.39 8.3.10(In this case, we need to find this version)
3.0 8.3.11
3.1 8.3.11
--------------------------------------------------------------------------------
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Again, RHEL not longer support DRBD, need to manully setup:
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
────────────────────────────────────────────────────────────────────────────────
Install DRBD kernel module and utils package from ELRepo:
────────────────────────────────────────────────────────────────────────────────
# uname -a
--------------------------------------------------------------------------------
Linux CentOS6-ocfs2-1 2.6.39-200.29.2.el6uek.i686
#1 SMP Sat Jul 14 10:50:31 EDT 2012 i686 i686 i386 GNU/Linux
--------------------------------------------------------------------------------
Note: as before setup step, I am using the UEK kernel(this also come from RHEL) .
Download packages:
http://www.drbd.org/download/packages/
http://mirror.centos.org/centos/5/extras/x86_64/RPMS/
(CentOS6 not longer provide the extras package now !)
Install from ELRepo:
http://elrepo.org/tiki/tiki-index.php
# rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
# yum install install yum-plugin-fastestmirror
# yum search drbd
--------------------------------------------------------------------------------
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.grandcloud.cn
* elrepo: repos.lax-noc.com
* extras: mirrors.grandcloud.cn
* updates: mirrors.grandcloud.cn
================== Matched: drbd =====================
drbd83-utils.i686 : Management utilities for DRBD %{version}
drbd84-utils.i686 : Management utilities for DRBD
kmod-drbd83.i686 : drbd83 kernel module(s)
kmod-drbd84.i686 : drbd84 kernel module(s)
--------------------------------------------------------------------------------
Generally, you need to install two packages suitable to your linux kernel:
# yum install kmod-drbd83;
# yum install drbd83-utils;
────────────────────────────────────────────────────────────────────────────────
Install DRBD utils from ELRepo:
────────────────────────────────────────────────────────────────────────────────
As I use the UEK kernel in this case, there is already drbd module included, so
I only need to install the drbd83-utils package here. First I need to find the
current drbd module version:
# modinfo drbd;
--------------------------------------------------------------------------------
filename: /lib/modules/2.6.39-200.29.2.el6uek.i686/kernel/drivers/block/drbd/drbd.ko
alias: block-major-147-*
license: GPL
version: 8.3.11
description: drbd - Distributed Replicated Block Device v8.3.11
author: Philipp Reisner , Lars Ellenberg
srcversion: DA5A13F16DE6553FC7CE9B2
depends: lru_cache
vermagic: 2.6.39-200.29.2.el6uek.i686 SMP mod_unload modversions 686
parm: minor_count:Maximum number of drbd devices (1-256) (uint)
parm: disable_sendpage:bool
parm: allow_oos:DONT USE! (bool)
parm: cn_idx:uint
parm: proc_details:int
parm: enable_faults:int
parm: fault_rate:int
parm: fault_count:int
parm: fault_devs:int
parm: usermode_helper:string
--------------------------------------------------------------------------------
As you can see, the current drbd kernel module version is 8.3.11, so I need to
find and install the corresponding drbd83-utils version package. The source code
offically are available on the oss.linbit.com site: http://oss.linbit.com/drbd/
# wget http://oss.linbit.com/drbd/8.3/drbd-8.3.11.tar.gz;
# cp drbd-8.3.11.tar.gz /root/rpmbuild/SOURCES/
# tar zxvf drbd-8.3.11.tar.gz
# cd drbd-8.3.11/;
# ./autogen.sh
# yum install flex;
# ./configure --enable-spec
# ./configure --with-km --enable-spec; #if you need kernel module;
Note: the kernel module of drbd source code can not compile in UEK kernel.
# cat drbd.spec;
# rpmbuild -ba drbd.spec;
# /bin/ls -1 -d /root/rpmbuild/RPMS/i386/*
--------------------------------------------------------------------------------
/root/rpmbuild/RPMS/i386/drbd-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-bash-completion-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-heartbeat-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-pacemaker-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-udev-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-utils-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-xen-8.3.11-1.el6.i386.rpm
--------------------------------------------------------------------------------
# rpm -ivh /root/rpmbuild/RPMS/i386/drbd-utils-8.3.11-1.el6.i386.rpm
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Ref: http://en.gentoo-wiki.com/wiki/Active-active_DRBD_with_OCFS2
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
────────────────────────────────────────────────────────────────────────────────
Configurate the DRBD resource
────────────────────────────────────────────────────────────────────────────────
# vi /etc/drbd.d/global_common.conf;
--------------------------------------------------------------------------------
global {
usage-count yes;
# minor-count dialog-refresh disable-ip-verification
}
common {
protocol C;
handlers {
pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
pri-lost-after-sb "/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
local-io-error "/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f";
# fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
# split-brain "/usr/lib/drbd/notify-split-brain.sh root";
# out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";
# before-resync-target "/usr/lib/drbd/snapshot-resync-target-lvm.sh -p 15 -- -c 16k";
# after-resync-target /usr/lib/drbd/unsnapshot-resync-target-lvm.sh;
}
startup {
# wfc-timeout degr-wfc-timeout outdated-wfc-timeout wait-after-sb
wfc-timeout 60;# Wait for connection timeout
degr-wfc-timeout 60;# Wait for connection timeout, if this node was a degraded cluster
}
disk {
# on-io-error fencing use-bmbv no-disk-barrier no-disk-flushes
# no-disk-drain no-md-flushes max-bio-bvecs
on-io-error detach;# Drop the disk on io error
}
net {
# sndbuf-size rcvbuf-size timeout connect-int ping-int ping-timeout max-buffers
# max-epoch-size ko-count allow-two-primaries cram-hmac-alg shared-secret
# after-sb-0pri after-sb-1pri after-sb-2pri data-integrity-alg no-tcp-cork
}
syncer {
# rate after al-extents use-rle cpu-mask verify-alg csums-alg
rate 10M;# Limit sync speed to 10 MByte/s for FastEthernet
}
}
--------------------------------------------------------------------------------
Note: on 100Mbit ethernet cannot expect more than 12.5 MByte total transfer rate.
You must specify the wfc-timeout with non-zero value, as the default value is 0
and it means unlimit, the DRBD service will wait forever untill find other node.
# cat /etc/drbd.conf
--------------------------------------------------------------------------------
# You can find an example in /usr/share/doc/drbd.../drbd.conf.example
include "drbd.d/global_common.conf";
include "drbd.d/*.res";
--------------------------------------------------------------------------------
# cat /usr/share/doc/drbd83-utils-8.3.13/drbd.conf.example
# vi /etc/drbd.d/ocfs2.res;
--------------------------------------------------------------------------------
# DRBD resource for OCFS2 storage
resource ocfs2 {
protocol C;
on centos6-ocfs2-1 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.56.201:7789;
meta-disk internal;
}
on centos6-ocfs2-2 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.56.202:7789;
meta-disk internal;
}
}
--------------------------------------------------------------------------------
Note: this setting need to change later when Switch DRBD to Active-Active mode
# vi /etc/hosts;
--------------------------------------------------------------------------------
192.168.56.201 centos6-ocfs2-1 co1
192.168.56.202 centos6-ocfs2-2 co2
--------------------------------------------------------------------------------
# scp /etc/drbd.d/global_common.conf centos6-ocfs2-2:/etc/drbd.d/
# scp /etc/drbd.d/ocfs2.res centos6-ocfs2-2:/etc/drbd.d/
────────────────────────────────────────────────────────────────────────────────
Enable DRBD resource first time(theses commands must be issued on both nodes)
────────────────────────────────────────────────────────────────────────────────
(1) Run this command on node1 server first:
[root@centos6-ocfs2-1]# drbdadm create-md ocfs2;
--------------------------------------------------------------------------------
DRBD module version: 8.3.11
userland version: 8.3.13
preferably kernel and userland versions should match.
--== Thank you for participating in the global usage survey ==--
The server's response is:
you are the 6358th user to install this version
md_offset 1069248512
al_offset 1069215744
bm_offset 1069182976
Found some data
==> This might destroy existing data! <==
Do you want to proceed?
[need to type 'yes' to confirm] yes
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.
success
--------------------------------------------------------------------------------
[root@centos6-ocfs2-1]# drbdadm up ocfs2;
--------------------------------------------------------------------------------
DRBD module version: 8.3.11
userland version: 8.3.13
preferably kernel and userland versions should match.
--------------------------------------------------------------------------------
(2) Run this command on node2 server now:
[root@centos6-ocfs2-2]# drbdadm create-md ocfs2;
[root@centos6-ocfs2-2]# drbdadm up ocfs2;
(3) Check the DRBD status:
# lsmod | grep drbd
--------------------------------------------------------------------------------
drbd 241802 2
lru_cache 5940 1 drbd
--------------------------------------------------------------------------------
# cat /proc/drbd
--------------------------------------------------------------------------------
version: 8.3.11 (api:88/proto:86-96)
srcversion: DA5A13F16DE6553FC7CE9B2
0: cs:WFConnection ro:Secondary/Unknown ds:Inconsistent/DUnknown C r----s
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:1044124
--------------------------------------------------------------------------------
# /etc/init.d/drbd status; # (Waiting node2 to connect);
--------------------------------------------------------------------------------
drbd driver loaded OK; device status:
version: 8.3.11 (api:88/proto:86-96)
srcversion: DA5A13F16DE6553FC7CE9B2
m:res cs ro ds p mounted fstype
0:ocfs2 WFConnection Secondary/Unknown Inconsistent/DUnknown C
--------------------------------------------------------------------------------
# /etc/init.d/drbd status; # (When node2 connected, status change);
--------------------------------------------------------------------------------
drbd driver loaded OK; device status:
version: 8.3.11 (api:88/proto:86-96)
srcversion: DA5A13F16DE6553FC7CE9B2
m:res cs ro ds p mounted fstype
0:ocfs2 Connected Secondary/Secondary Inconsistent/Inconsistent C
--------------------------------------------------------------------------------
Note: both notes will be Secondary, as the devices still need to be initial.
(4) DRBE relevant Files:
/dev/drbd0
/dev/drbd
/dev/drbd/by-disk
/dev/drbd/by-disk/sdb1
/dev/drbd/by-res
/dev/drbd/by-res/ocfs2
/dev/.udev/links/drbd\x2fby-disk\x2fsdb1
/dev/.udev/links/drbd\x2fby-res\x2focfs2
────────────────────────────────────────────────────────────────────────────────
Initial and Syncing the nodes (performed on only one node)
────────────────────────────────────────────────────────────────────────────────
Now DRBD has successfully allocated both disk and network resources is ready for
operation. What it does not know yet is which nodes should be used as the source
of the initial device synchronization.
Start the initial full synchronization:
[root@centos6-ocfs2-1]# drbdadm -- --overwrite-data-of-peer primary ocfs2;
--------------------------------------------------------------------------------
DRBD module version: 8.3.11
userland version: 8.3.13
preferably kernel and userland versions should match.
--------------------------------------------------------------------------------
Note: This command must be performed on only one node, only on initial resource
configuration, and only on the node you selected as the synchronization source.
# /etc/init.d/drbd status
--------------------------------------------------------------------------------
drbd driver loaded OK; device status:
version: 8.3.11 (api:88/proto:86-96)
srcversion: DA5A13F16DE6553FC7CE9B2
m:res cs ro ds p mounted fstype
0:ocfs2 Connected Primary/Secondary UpToDate/UpToDate C
--------------------------------------------------------------------------------
Note: Both nodes's status change to Primary/Secondary and UpToDate/UpToDate now.
────────────────────────────────────────────────────────────────────────────────
Start drbd and ocfs2, building OCFS2 filesystem (performed on only one node)
────────────────────────────────────────────────────────────────────────────────
[root@centos6-ocfs2-1]# /etc/init.d/o2cb load
[root@centos6-ocfs2-1]# /etc/init.d/o2cb online
[root@centos6-ocfs2-2]# /etc/init.d/o2cb load
[root@centos6-ocfs2-2]# /etc/init.d/o2cb online
# /etc/init.d/o2cb status
--------------------------------------------------------------------------------
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster "ocfs2": Online
Heartbeat dead threshold: 31
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Heartbeat mode: Local
Checking O2CB heartbeat: Not active
--------------------------------------------------------------------------------
Note: Both nodes should be loaded and onlined with the O2CB control script,
but do not active the heartbeat before we formate the OCFS2 filesystem.
[root@centos6-ocfs2-1]# mkfs.ocfs2 -N 2 -L ocfs2 /dev/drbd0
--------------------------------------------------------------------------------
mkfs.ocfs2 1.8.0
Cluster stack: classic o2cb
Overwriting existing ocfs2 partition.
Proceed (y/N): y
Label: ocfs2
Features: sparse extended-slotmap backup-super unwritten inline-data
strict-journal-super xattr indexed-dirs refcount discontig-bg
Block size: 2048 (11 bits)
Cluster size: 4096 (12 bits)
Volume size: 1069182976 (261031 clusters) (522062 blocks)
Cluster groups: 17 (tail covers 7079 clusters, rest cover 15872 clusters)
Extent allocator size: 4194304 (1 groups)
Journal size: 33554432
Node slots: 2
Creating bitmaps: done
Initializing superblock: done
Writing system files: done
Writing superblock: done
Writing backup superblock: 0 block(s)
Formatting Journals: done
Growing extent allocator: done
Formatting slot map: done
Formatting quota files: done
Writing lost+found: done
mkfs.ocfs2 successful
--------------------------------------------------------------------------------
Note: This command must be done on the Primary node only. The filesystem will be
created on the drdb device which is active and will replicate to the other nodes.
[root@centos6-ocfs2-1 ~]# mounted.ocfs2 -d
--------------------------------------------------------------------------------
Device Stack Cluster F UUID Label
/dev/sdb o2cb 7C477028C9F942C1BC5CAFF2B24A7A5A
/dev/sdb1 o2cb 0AFD511ACB744A5BB7EC21BAF3323883 ocfs2
/dev/drbd0 o2cb 0AFD511ACB744A5BB7EC21BAF3323883 ocfs2
--------------------------------------------------------------------------------
[root@centos6-ocfs2-2]# /etc/init.d/drbd force-reload;# Update driver;
[root@centos6-ocfs2-2]# /etc/init.d/drbd restart; # Or restart;
[root@centos6-ocfs2-2 drbd.d]# mounted.ocfs2 -d
--------------------------------------------------------------------------------
Device Stack Cluster F UUID Label
/dev/sdb o2cb 99BF2CA35AD1498CA2D8EA9315F0605D
/dev/sdb1 o2cb 0AFD511ACB744A5BB7EC21BAF3323883 ocfs2
/dev/drbd0 o2cb 0AFD511ACB744A5BB7EC21BAF3323883 ocfs2
--------------------------------------------------------------------------------
────────────────────────────────────────────────────────────────────────────────
Switch the DRBD in Active-Active mode
────────────────────────────────────────────────────────────────────────────────
# vi /etc/drbd.d/ocfs2.res;
--------------------------------------------------------------------------------
# DRBD resource for OCFS2 storage
resource ocfs2 {
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 centos6-ocfs2-1 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.56.201:7789;
meta-disk internal;
}
on centos6-ocfs2-2 {
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.56.202:7789;
meta-disk internal;
}
}
--------------------------------------------------------------------------------
Note: Add startup{} and net{} on both nodes, not need to changing other settings.
参数解释:
allow-two-primaries
- Generally, DRBD has a primary and a secondary node. In this case, we will allow
both nodes to have the filesystem mounted at the same time. Do this only with
a clustered filesystem. If you do this with a non-clustered filesystem like
ext2/ext3/ext4 or reiserfs, you will have data corruption. Seriously!
after-sb-0pri discard-zero-changes
- DRBD detected a split-brain scenario, but none of the nodes think they're a primary.
DRBD will take the newest modifications and apply them to the node that didn't have any changes.
after-sb-1pri discard-secondary
- DRBD detected a split-brain scenario, but one node is the primary and the other is the secondary.
In this case, DRBD will decide that the secondary node is the victim and it will sync data
from the primary to the secondary automatically.
after-sb-2pri disconnect
- DRBD detected a split-brain scenario, but it can't figure out which node has the right data.
It tries to protect the consistency of both nodes by disconnecting the DRBD volume entirely.
You'll have to tell DRBD which node has the valid data in order to reconnect the volume.
Use extreme caution if you find yourself in this scenario.
[root@centos6-ocfs2-1]# /etc/init.d/drbd restart;
(Waiting to the restart untill it successfully,and then restart node2's DRBD)
[root@centos6-ocfs2-2]# /etc/init.d/drbd restart;
# /etc/init.d/drbd status
--------------------------------------------------------------------------------
drbd driver loaded OK; device status:
version: 8.3.11 (api:88/proto:86-96)
srcversion: DA5A13F16DE6553FC7CE9B2
m:res cs ro ds p mounted fstype
0:ocfs2 Connected Primary/Primary UpToDate/UpToDate C
--------------------------------------------------------------------------------
Note: now both nodes have the same status Primary/Primary.
# vi /etc/fstab; # configurate the bootup mount point;
--------------------------------------------------------------------------------
/dev/drbd0 /mnt/ocfs ocfs2 _netdev,datavolume,nointr0 0
--------------------------------------------------------------------------------
# /etc/init.d/ocfs2 start
# /etc/init.d/o2cb status
--------------------------------------------------------------------------------
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster "ocfs2": Online
Heartbeat dead threshold: 31
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Heartbeat mode: Local
Checking O2CB heartbeat: Active
--------------------------------------------------------------------------------
Note: both nodes's heartbeat active now.
# /usr/sbin/drbd-overview; #(a perl script come form drbd8x-utils);
--------------------------------------------------------------------------------
0:ocfs2 Connected Primary/Primary UpToDate/UpToDate C r----- /mnt/ocfs ocfs2 1020M 82M 939M 8%
--------------------------------------------------------------------------------
Note: drbd-overview is just a simple perl script to read /proc/drbd;
Testing to change or add files on both nodes, and you will see the changing had
been synchronized to other node immediately. Successfully and completed now !
################################################################################
Startup Setup(If reboot linux can not mount the OCFS2 file system automatically)
################################################################################
Note: make sure the ocfs2 script run after drbd script when linux system stratup.
# vi /etc/init.d/ocfs2;
--------------------------------------------------------------------------------
# chkconfig: 2345 25 18
--------------------------------------------------------------------------------
# cat /etc/init.d/o2cb
--------------------------------------------------------------------------------
# chkconfig: 2345 24 19
--------------------------------------------------------------------------------
As you can see, the start and stop priorities of o2cb and ocfs2 are 24 and 25 .
# vi /etc/init.d/drbd
--------------------------------------------------------------------------------
# chkconfig: - 70 08
# Should-Start: sshd multipathd
# Should-Stop: sshd multipathd
CHANGE TO:
# chkconfig: - 23 08
# Should-Start:
# Should-Stop:
--------------------------------------------------------------------------------
# chkconfig --del drbd;
# chkconfig --add drbd;
# /bin/ls -l -d /etc/rc*.d/*drbd*;
# chkconfig drbd off;
# chkconfig drbd on;
# /bin/ls -l -d /etc/rc*.d/*drbd*;
# vi /etc/init.d/httpd;
--------------------------------------------------------------------------------
# chkconfig: - 85 15
CHANGE TO:
# chkconfig: - 85 05
--------------------------------------------------------------------------------
# chkconfig --del httpd;
# chkconfig --add httpd;
# /bin/ls -l -d /etc/rc*.d/*httpd*;
# chkconfig httpd off;
# chkconfig httpd on;
# /bin/ls -l -d /etc/rc*.d/*httpd*;
################################################################################
Debug: 当使用Active-Active模式时出现两边都是StandAlone的情况之处理
################################################################################
# drbd-overview; #Both two nodes change to StandAlone
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0:ocfs2 StandAlone Primary/Unknown UpToDate/DUnknown r----- /mnt/ocfs ocfs2 1020M 82M 939M 8%
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(1) first, check both file system and decide with node to give up;
(2) stop the mount point on this node:
# /etc/init.d/ocfs2 stop;
(3) disconnect the drbd device:
# drbdadm disconnect all;
(4) change to secondary status:
# drbdadm secondary all;
# drbdadm -- --discard-my-data connect all;
# drbd-overview;
(5) on the other node, if its connection state is also StandAlone, you would enter:
# drbdadm connect all;
# drbd-overview;
(6) check the re-synchronization status
# /etc/init.d/drbd status;
(7) switch back to primary status
# drbdadm primary all;
# drbd-overview;
(8) mount the partition on:
# /etc/init.d/ocfs2 start;
# drbd-overview;
