基於heartbeat的NFS HA實現(轉)

post0發表於2007-08-10
基於heartbeat的NFS HA實現(轉)[@more@]

摘要

本系統由兩臺Dell PowerEdge 2650(HUTUNFS1 & HUTUNFS2)和一臺磁碟陣列組成,磁碟陣列劃分為ld0 & ld1兩個RAID5邏輯盤(Logical Disk)。作業系統為RedHat 7.3 Linux。設定NFS HA 的目的是,當HUTUNFS1失敗時HUTUNFS2自動接管。(2003-10-14 14:42:55)

By 小糊塗蟲

基於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

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服務。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8225414/viewspace-941530/,如需轉載,請註明出處,否則將追究法律責任。

相關文章