Heartbeat+DRBD+NFS 构建高可用的文件系统

 参考http://freeloda.blog.51cto.com/2033581/1189126

 主要几个要点

 1.vim global_common.conf

global {
usage-count no;
# 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 120;
  degr-wfc-timeout 120;
}
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;
                 fencing resource-only;
}
net {
cork
cram-hmac-alg  "sha1" ;
shared-secret  "mydrbdlab" ;
}
syncer {
# rate after al-extents use-rle cpu-mask verify-alg csums-alg
rate 100M;
}

}

2.vim web.res

resource web {
                 on drbd1. free .com {
                         device  /dev/drbd0 ;
                         disk  /dev/sda6 ;
                         address 192.168.18.211:7789;
                         meta-disk internal;
                 }
                 on drbd2. free .com {
                         device  /dev/drbd0 ;
                         disk  /dev/sda6 ;
                         address 192.168.18.212:7789;
                         meta-disk internal;
                 }
}

3.vim ha.cf

logfacility local0

bcast eth1 # Linux
mcast eth0 225.0.0.1 694 1 0
auto_failback on

nodedrbd1.free.com

nodedrbd2. free .com

4.vim haresources

drbd1.free.com IPaddr::192.168.18.200/24/eth0 drbddisk::webFilesystem::/dev/drbd0::/mnt/drbd::ext3 killnfsd

5.vim resource.d/killnfsd

killall -9 nfsd;
/etc/init .d /nfs   restart;
exit   0

6.chkconfig nfs on

chkconfig drbd on
chkconfig heartbeat on


你可能感兴趣的:(heartbeat,nfs,drbd)