- 論壇徽章:
- 0
|
RHEL5下安裝GFS集群文件系統(tǒng)
GFS是RedHat公司Global File System的簡稱,GFS是一個文件系統(tǒng),為底層的共享塊設(shè)備在文件系統(tǒng)級別提供并發(fā)的讀寫功能。與傳統(tǒng)的NAS結(jié)構(gòu)不同,GFS的文件系統(tǒng)層運行于高帶寬的FC協(xié)議網(wǎng)絡(luò)(NAS的文件系統(tǒng)層依托傳統(tǒng)的IP網(wǎng)絡(luò)實現(xiàn)),因此更能發(fā)揮SAN存儲架構(gòu)的性能優(yōu)勢。GFS提供三種存儲解決方案架構(gòu):
1 高性能和高可測性
![]()
GFS with a SAN如圖一,多臺GFS節(jié)點直接通過FC交換機連接到SAN存儲體,應(yīng)用程序直接跑在GFS節(jié)點上,避免了傳統(tǒng)NAS架構(gòu)中文件服務(wù)器節(jié)點的各種瓶頸和IP網(wǎng)絡(luò)延遲。這種架構(gòu)可支持300個GFS節(jié)點。
2 兼顧性能、可測性、價格
![]()
GFS and GNBD with a SAN如圖二,這種方式跨越IP跟FC兩種協(xié)議,SAN存儲通過GNBD(Global Network Block Device)被export到傳統(tǒng)的IP網(wǎng)絡(luò),這似乎和NAS的架構(gòu)有點類似,但實際上有巨大的區(qū)別,首先NAS的文件服務(wù)器只有一個(當(dāng)然也可以實現(xiàn)互為HA的架構(gòu)),而GFS種的GNBD可以有多個,且是負(fù)載均衡(負(fù)載均衡本身包含了HA)的架構(gòu);其次NAS在IP網(wǎng)絡(luò)上運行的是文件系統(tǒng)級別的操作,我們知道,文件系統(tǒng)級別的操作對系統(tǒng)資源的消耗是巨大的,而GFS在IP網(wǎng)絡(luò)上跑的是比文件系統(tǒng)更底層的類似ISCSI的協(xié)議,即數(shù)據(jù)塊被封裝在IP包中進(jìn)行傳輸,因此在效率上會比NAS高。每一個GNBD在內(nèi)存中都有一個線程池,線程用于處理到SAN存儲中一個數(shù)據(jù)塊的路徑映射,因此,每一個SAN存儲體都能通過任意一個GNBD來訪問,實現(xiàn)了負(fù)載均衡和HA。
3 更經(jīng)濟(jì),兼顧性能
![]()
GFS and GNBD with Directly Connected Storage如圖三,這種架構(gòu)和圖二中的架構(gòu)最大的區(qū)別是沒有SAN存儲體,存儲方式是直連存儲(DAS),這種方式可以在傳統(tǒng)環(huán)境中輕松實現(xiàn),但是需要考慮對GNBD和它的DAS的冗余。
第二種方法在節(jié)點少的情況下沒有優(yōu)勢反而存在gndb單點故障(如果gnbd上不做HA或多個gnbd的話),我根據(jù)需求,選擇第一種方法。這樣可以避免gnbd單點故障問題。
一、硬件環(huán)境
3臺HPdl380 g3
配置:Xeon(TM)2.80G*2/2G/36G*3(raid5)
操作系統(tǒng):Red Hat Enterprise Linux Server release 5.3 (Tikanga)32bit
2.6.18-128.el5xen
主機:
1. 主機名 IP地址
gfs1 192.168.0.21
gfs2 192.168.0.22
gfs3 192.168.0.23
2.fence_ilo資源
fence名 IP地址 登錄用戶名 密碼
gfs1ilo 192.168.0.11 Administrator 123456
gfs2ilo 192.168.0.12 Administrator 123456
gfs2ilo 192.168.0.13 Administrator 123456
軟件版本:
cman-2.0.98-1.el5.i386.rpm
gfs2-utils-0.1.53-1.el5.i386.rpm
gfs-utils-0.1.18-1.el5.i386.rpm
ipvsadm-1.24-8.1.i386.rpm
kmod-gfs-0.1.31-3.el5.i686.rpm(因為我的cpu是xen 這個不用安裝)
kmod-gfs-xen-0.1.31-3.el5.i686.rpm
openais-0.80.3-22.el5.i386.rpm
perl-Net-Telnet-3.03-5.noarch.rpm
perl-XML-LibXML-1.58-5.i386.rpm
perl-XML-LibXML-Common-0.13-8.2.2.i386.rpm
perl-XML-NamespaceSupport-1.09-1.2.1.noarch.rpm
perl-XML-SAX-0.14-5.noarch.rpm
pexpect-2.3-1.el5.noarch.rpm
piranha-0.8.4-11.el5.i386.rpm
rgmanager-2.0.46-1.el5.centos.i386.rpm
system-config-cluster-1.0.55-1.0.noarch.rpm
二,Red Hat Cluster及gfs安裝步驟:
安裝有依賴關(guān)系,循列為:
rpm -ivh perl-Net-Telnet-3.03-5.noarch.rpm
rpm -ivh perl-XML-SAX-0.14-5.noarch.rpm
rpm -ivh perl-XML-NamespaceSupport-1.09-1.2.1.noarch.rpm
rpm -ivh perl-XML-LibXML-Common-0.13-8.2.2.i386.rpm
rpm -ivh perl-XML-LibXML-1.58-5.i386.rpm
rpm -ivh pexpect-2.3-1.el5.noarch.rpm
rpm -ivh openais-0.80.3-22.el5.i386.rpm
rpm -ivh ipvsadm-1.24-8.1.i386.rpm
rpm -ivh piranha-0.8.4-11.el5.i386.rpm
rpm -ivh gfs2-utils-0.1.53-1.el5.i386.rpm
rpm -ivh gfs-utils-0.1.18-1.el5.i386.rpm
rpm -ivh kmod-gfs-xen-0.1.31-3.el5.i686.rpm
rpm -ivh cman-2.0.98-1.el5.i386.rpm
rpm -ivh rgmanager-2.0.46-1.el5.centos.i386.rpm
rpm -ivh system-config-cluster-1.0.55-1.0.noarch.rpm
設(shè)置hosts
vi /etc/hosts 加入
192.168.0.23 gfs3
192.168.0.22 gfs2
192.168.0.21 gfs1
設(shè)置集群配置文件
vi /etc/cluster/cluster.conf 加入
測式fence設(shè)備
fence_ilo -a 192.168.0.11 -l Administrator -p 123456 -o status
Status: ON
fence_ilo -a 192.168.0.12 -l Administrator -p 123456 -o status
Status: ON
fence_ilo -a 192.168.0.13 -l Administrator -p 123456 -o status
Status: ON
說明三臺服務(wù)器fence設(shè)備正常.
啟動集群服務(wù)
[root@gfs1 ~]# service cman start
Starting cluster:
Enabling workaround for Xend bridged networking... done
Loading modules... done
Mounting configfs... done
Starting ccsd... done
Starting cman... done
Starting daemons... done
Starting fencing... done
[確定]
[root@gfs1 ~]# service rgmanager start
分別在三臺服務(wù)器上啟動
顯示集群狀態(tài)
root@gfs1 ~]# clustat
Cluster Status for alpha_cluster @ Fri Sep 11 16:06:05 2009
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
gfs1 1 Online, Local
gfs2 2 Online
gfs3 3 Online
到目前為止集群已經(jīng)配置成功了,還差gfs服務(wù).
由于環(huán)境沒有nas 或san陣列環(huán)境 我用軟件iscsi-initiator scsi-target-utils 組合來模擬
步驟見我blog上另一篇文章.
創(chuàng)建gfs系統(tǒng)
gfs_mkfs -p lock_dlm -t alpha_cluster:gfs -j 3 /dev/sda1
It appears to contain a GFS filesystem.
Are you sure you want to proceed? [y/n] y
Device: /dev/sda1
Blocksize: 4096
Filesystem Size: 669344
Journals: 2
Resource Groups: 12
Locking Protocol: lock_dlm
Lock Table: alpha_cluster:gfs
Syncing...
All Done
在三個節(jié)點掛載文件系統(tǒng)
[root@gfs1 cluster] # mount -t gfs /dev/sda1 /mnt/gfs
[root@gfs2 cluster] # mount -t gfs /dev/sda1 /mnt/gfs
[root@gfs3 cluster] # mount -t gfs /dev/sda1 /mnt/gfs
收尾步驟:
vi /etc/fstab 加入
/dev/sda1 /mnt/gfs1 gfs defaults 0 0
加入開機啟動參數(shù)(注意先后循序)
chkconfig --level 2345 rgmanager on
chkconfig --level 2345 gfs on
chkconfig --level 2345 cman on
To start the cluster software on a member, type the following commands in this order:
service cman start
service gfs start, if you are using Red Hat GFS
service rgmanager start
To stop the cluster software on a member, type the following commands in this order:
service rgmanager stop
service gfs stop, if you are using Red Hat GFS
service cman stop
以下是redhat官方的解釋
-----------------------------------------------------------------------
It may become necessary to temporarily disable the cluster software on a cluster member. For example, if a cluster member experiences a hardware failure, you may want to reboot that member, but prevent it from rejoining the cluster to perform maintenance on the system.
Use the /sbin/chkconfig command to stop the member from joining the cluster at boot-up as follows: # chkconfig --level 2345 rgmanager off
# chkconfig --level 2345 gfs off
# chkconfig --level 2345 clvmd off
# chkconfig --level 2345 cman off
Once the problems with the disabled cluster member have been resolved, use the following commands to allow the member to rejoin the cluster: # chkconfig --level 2345 rgmanager on
# chkconfig --level 2345 gfs on
# chkconfig --level 2345 clvmd on
# chkconfig --level 2345 cman on
You can then reboot the member for the changes to take effect or run the following commands in the order shown to restart cluster software:
service cman start
service clvmd start, if CLVM has been used to create clustered volumes
service gfs start, if you are using Red Hat GFS
service rgmanager start
故障測試:
把gfs3主機的網(wǎng)線拔了
在gfs1上看日志如下
Sep 11 16:38:01 gfs1 openais[3408]: [TOTEM] The token was lost in the OPERATIONAL state.
Sep 11 16:38:01 gfs1 openais[3408]: [TOTEM] Receive multicast socket recv buffer size (288000 bytes).
Sep 11 16:38:01 gfs1 openais[3408]: [TOTEM] Transmit multicast socket send buffer size (262142 bytes).
Sep 11 16:38:01 gfs1 openais[3408]: [TOTEM] entering GATHER state from 2.
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] entering GATHER state from 0.
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] Creating commit token because I am the rep.
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] Saving state aru 50 high seq received 50
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] Storing new sequence id for ring 153b0
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] entering COMMIT state.
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] entering RECOVERY state.
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] position [0] member 192.168.0.21:
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] previous ring seq 86956 rep 192.168.0.21
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] aru 50 high delivered 50 received flag 1
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] position [1] member 192.168.0.22:
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] previous ring seq 86956 rep 192.168.0.21
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] aru 50 high delivered 50 received flag 1
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] Did not need to originate any messages in recovery.
Sep 11 16:38:06 gfs1 kernel: dlm: closing connection to node 3
Sep 11 16:38:06 gfs1 fenced[3428]: gfs3 not a cluster member after 0 sec post_fail_delay
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] Sending initial ORF token
Sep 11 16:38:06 gfs1 fenced[3428]: fencing node "gfs3"
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] CLM CONFIGURATION CHANGE
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] New Configuration:
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] r(0) ip(192.168.0.21)
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] r(0) ip(192.168.0.22)
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] Members Left:
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] r(0) ip(192.168.0.23)
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] Members Joined:
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] CLM CONFIGURATION CHANGE
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] New Configuration:
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] r(0) ip(192.168.0.21)
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] r(0) ip(192.168.0.22)
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] Members Left:
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] Members Joined:
Sep 11 16:38:06 gfs1 openais[3408]: [SYNC ] This node is within the primary component and will provide service.
Sep 11 16:38:06 gfs1 openais[3408]: [TOTEM] entering OPERATIONAL state.
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] got nodejoin message 192.168.0.21
Sep 11 16:38:06 gfs1 openais[3408]: [CLM ] got nodejoin message 192.168.0.22
Sep 11 16:38:06 gfs1 openais[3408]: [CPG ] got joinlist message from node 2
Sep 11 16:38:06 gfs1 openais[3408]: [CPG ] got joinlist message from node 1
Sep 11 16:38:19 gfs1 fenced[3428]: fence "gfs3" success
Sep 11 16:38:19 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Trying to acquire journal lock...
Sep 11 16:38:19 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Looking at journal...
Sep 11 16:38:20 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Acquiring the transaction lock...
Sep 11 16:38:20 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Replaying journal...
Sep 11 16:38:22 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Replayed 0 of 1 blocks
Sep 11 16:38:22 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: replays = 0, skips = 0, sames = 1
Sep 11 16:38:22 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Journal replayed in 3s
Sep 11 16:38:22 gfs1 kernel: GFS: fsid=alpha_cluster:gfs.2: jid=0: Done
剛才被拔網(wǎng)線的gfs3主機被fence_ilo 成功,也就是被fence_ilo命令重啟.
[root@gfs3 ~]# last
root pts/1 192.168.13.120 Sat Sep 12 00:45 still logged in
reboot system boot 2.6.18-128.el5xe Sat Sep 12 00:42 (00:03)
本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u1/40226/showart_2050414.html |
|