基于heartbeat的NFS HA实现
时间:2007-02-17 来源:PHP爱好者
基于heartbeat的NFS HA实现
Version: 1.0
Maintainer: hutuworm
Update: 2003-09-30
※系统说明
本系统由两台Dell PowerEdge 2650(HUTUNFS1 & HUTUNFS2)和一台磁盘阵列组成,磁盘阵列
划分为ld0 & ld1两个RAID5逻辑盘(Logical Disk)。操作系统为RedHat 7.3 Linux。设置NFS HA
的目的是,当HUTUNFS1失败时HUTUNFS2自动接管。
1 安装heartbeat 1.0.3 for RedHat 7.3
http://www.ultramonkey.org/download/heartbeat/1.0.3/redhat_7.3/
heartbeat-1.0.3-1.rh.7.3.1.i386.rpm
heartbeat-ldirectord-1.0.3-1.rh.7.3.1.i386.rpm
heartbeat-pils-1.0.3-1.rh.7.3.1.i386.rpm
heartbeat-stonith-1.0.3-1.rh.7.3.1.i386.rpm
2 设置配置文件:
HUTUNFS1为master,HUTUNFS2为slave。
2.1 HUTUNFS1 192.168.0.30
/etc/ha.d/ha.cf
# define nodes in cluster
node hutunfs1
node hutunfs2
# time a system must be unreachable before considered dead (seconds)
deadtime 5
# set up for the serial heartbeat pulse
# 如果两台服务器之间用心跳线连接,heartbeat支持串行心跳监测。
#serial /dev/ttyS0
#baud 19200
# interface to run the network heartbeat pulse
udp bond0
/etc/ha.d/authkeys
auth 3
3 md5 hutuworm
/etc/ha.d/haresources
hutunfs1 192.168.0.30 Filesystem::/dev/sdc1::/ld0::ext3 nfslock nfs
hutunfs1 192.168.0.30 Filesystem::/dev/sdd1::/ld1::ext3 nfslock nfs
/etc/exports
#
# Export the shared disk, allowing read/write access and
# synchronous I/O with no write delay.
/ld0 192.168.0.*(rw,sync,no_wdelay)
/ld1 192.168.0.*(rw,sync,no_wdelay)
/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 hutunfs1 localhost.localdomain localhost
192.168.0.30 hutunfs1
192.168.0.31 hutunfs2
2.2 HUTUNFS2 192.168.0.31
/etc/ha.d/ha.cf
/etc/ha.d/authkeys
/etc/ha.d/haresources
/etc/exports
以上四个文件与HUTUNFS1相同
/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 hutunfs2 localhost.localdomain localhost
192.168.0.30 hutunfs1
192.168.0.31 hutunfs2
3. 在HUTUNFS1 & HUTUNFS2上运行ntsysv,确认nfs服务关闭,heartbeat服务打开。
先重起HUTUNFS1,再重起HUTUNFS2,HUTUNFS1作为master运行,HUTUNFS2作为slave运行。
当HUTUNFS1失效时,HUTUNFS2将自动接管192.168.0.30,并同时开启NFS服务。
php爱好者站 http://www.phpfans.net dreamweaver|flash|fireworks|photoshop.
Version: 1.0
Maintainer: hutuworm
Update: 2003-09-30
※系统说明
本系统由两台Dell PowerEdge 2650(HUTUNFS1 & HUTUNFS2)和一台磁盘阵列组成,磁盘阵列
划分为ld0 & ld1两个RAID5逻辑盘(Logical Disk)。操作系统为RedHat 7.3 Linux。设置NFS HA
的目的是,当HUTUNFS1失败时HUTUNFS2自动接管。
1 安装heartbeat 1.0.3 for RedHat 7.3
http://www.ultramonkey.org/download/heartbeat/1.0.3/redhat_7.3/
heartbeat-1.0.3-1.rh.7.3.1.i386.rpm
heartbeat-ldirectord-1.0.3-1.rh.7.3.1.i386.rpm
heartbeat-pils-1.0.3-1.rh.7.3.1.i386.rpm
heartbeat-stonith-1.0.3-1.rh.7.3.1.i386.rpm
2 设置配置文件:
HUTUNFS1为master,HUTUNFS2为slave。
2.1 HUTUNFS1 192.168.0.30
/etc/ha.d/ha.cf
# define nodes in cluster
node hutunfs1
node hutunfs2
# time a system must be unreachable before considered dead (seconds)
deadtime 5
# set up for the serial heartbeat pulse
# 如果两台服务器之间用心跳线连接,heartbeat支持串行心跳监测。
#serial /dev/ttyS0
#baud 19200
# interface to run the network heartbeat pulse
udp bond0
/etc/ha.d/authkeys
auth 3
3 md5 hutuworm
/etc/ha.d/haresources
hutunfs1 192.168.0.30 Filesystem::/dev/sdc1::/ld0::ext3 nfslock nfs
hutunfs1 192.168.0.30 Filesystem::/dev/sdd1::/ld1::ext3 nfslock nfs
/etc/exports
#
# Export the shared disk, allowing read/write access and
# synchronous I/O with no write delay.
/ld0 192.168.0.*(rw,sync,no_wdelay)
/ld1 192.168.0.*(rw,sync,no_wdelay)
/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 hutunfs1 localhost.localdomain localhost
192.168.0.30 hutunfs1
192.168.0.31 hutunfs2
2.2 HUTUNFS2 192.168.0.31
/etc/ha.d/ha.cf
/etc/ha.d/authkeys
/etc/ha.d/haresources
/etc/exports
以上四个文件与HUTUNFS1相同
/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 hutunfs2 localhost.localdomain localhost
192.168.0.30 hutunfs1
192.168.0.31 hutunfs2
3. 在HUTUNFS1 & HUTUNFS2上运行ntsysv,确认nfs服务关闭,heartbeat服务打开。
先重起HUTUNFS1,再重起HUTUNFS2,HUTUNFS1作为master运行,HUTUNFS2作为slave运行。
当HUTUNFS1失效时,HUTUNFS2将自动接管192.168.0.30,并同时开启NFS服务。
php爱好者站 http://www.phpfans.net dreamweaver|flash|fireworks|photoshop.
相关阅读 更多 +