硬件環境 :雙 AMD 275HE雙核CPU/4G內存/73G scsi
操做系統 :RedHat AS 4 update 2
內核版本 :2.6.9-22.ELsmp
1. 到redhat 網站上下載相應的Cluster Suite/GFS軟件。因爲沒有註冊號,沒法經過up2date升級,所以會比較麻煩。
到ftp: //ftp.redhat.com/pub/redhat/linux/updates/enterprise/4AS/en/下載相應的RHCS和 RHGFS的src.rpm文件,在一個目錄下,每每有相同軟件的幾個版本存在。如下安裝筆記中所使用的軟件是以RHAS4 U2爲準。
1.1 安裝cman-kernel-2.6.9-39.5.src.rpm
rpm -iv cman-kernel-2.6.9-39.5.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba --nodeps cman-kernel.spec #加--nodeps 的緣由是提示,kernel-hugemem-devel = 2.6.9-22.EL is needed,嘗試解決未果,放棄。但願不會出現問題。
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh cman-ker*
1.2 安裝magma-1.0.1-4.src.rpm
rpm -iv magma-1.0.1-4.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba magma.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh magma*
1.3 安裝dlm-kernel-2.6.9-37.7.src.rpm
rpm -iv dlm-kernel-2.6.9-37.7.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba --nodeps dlm-kernel.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh dlm-kern*
1.4 安裝dlm-1.0.0-5.src.rpm
rpm -iv dlm-1.0.0-5.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba dlm.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh --nodeps dlm-1.0.0-5.x86_64.rpm
rpm -ivh dlm-debuginfo-1.0.0-5.x86_64.rpm
rpm -ivh dlm-devel-1.0.0-5.x86_64.rpm
1.5 安裝ccs-1.0.2-0.src.rpm
rpm -iv ccs-1.0.2-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba ccs.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh ccs*
1.6 安裝gulm-1.0.4-0.src.rpm
rpm -iv gulm-1.0.4-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba gulm.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh gulm-*
1.7 安裝magma-plugins-1.0.2-0.src.rpm
rpm -iv magma-plugins-1.0.2-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba magma-plugins.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh magma-plugins*
1.8 安裝cman-1.0.11-0.src.rpm
rpm -iv cman-1.0.11-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba cman.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh cman-*
1.9 安裝fence-1.32.10-0.src.rpm
rpm -iv fence-1.32.10-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba fence.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh fence-*
1.10 安裝iddev-2.0.0-3.src.rpm
rpm -iv iddev-2.0.0-3.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba iddev.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh iddev-*
1.11 安裝perl-Net-Telnet-3.03-1.2.el4.rf.src.rpm
可從http://ftp.belnet.be/packages/dr ... -1.2.el4.rf.src.rpm 下載
rpm -iv perl-Net-Telnet-3.03-1.2.el4.rf.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba perl-Net-Telnet.spec
cd /usr/src/redhat/RPMS/noarch/
rpm -ivh perl-Net-Telnet-3.03-1.2.el4.rf.noarch.rpm
1.13 安裝piranha-0.8.1-1.src.rpm
rpm -iv piranha-0.8.1-1.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba piranha.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh piranha-* --nodeps
1.14 安裝rgmanager-1.9.38-0.src.rpm
rpm -iv rgmanager-1.9.38-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba rgmanager.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh rgmanager-*
1.15 安裝system-config-cluster-1.0.16-1.0.src.rpm
rpm -iv system-config-cluster-1.0.16-1.0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba system-config-cluster.spec
cd /usr/src/redhat/RPMS/noarch/
rpm -ivh system-config-cluster-1.0.16-1.0.noarch.rpm
1.16 安裝GFS-kernel-2.6.9-42.1.src.rpm
rpm -iv GFS-kernel-2.6.9-42.1.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba --nodeps GFS-kernel.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh GFS-kern*
1.17 安裝GFS-6.1.2-0.src.rpm
rpm -iv GFS-6.1.2-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba GFS.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh GFS-6.1.2-0.x86_64.rpm
rpm -ivh GFS-debuginfo-6.1.2-0.x86_64.rpm
1.18 安裝gnbd-kernel-2.6.9-9.12.src.rpm
rpm -iv gnbd-kernel-2.6.9-9.12.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba --nodeps gnbd-kernel.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh gnbd-kern*
1.19 安裝gnbd-1.0.1-1.src.rpm
rpm -iv gnbd-1.0.1-1.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba gnbd.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh gnbd-1.0.1-1.x86_64.rpm
rpm -ivh gnbd-debuginfo-1.0.1-1.x86_64.rpm
1.20 安裝lvm2-cluster-2.01.14-1.0.RHEL4.src.rpm
rpm -iv lvm2-cluster-2.01.14-1.0.RHEL4.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba lvm2-cluster.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh lvm2-cluster*
1.21 安裝rgmanager-1.9.38-0.src.rpm
rpm -iv rgmanager-1.9.38-0.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba rgmanager.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh rgmanager-*
1.22 安裝ipvsadm-1.24-7.src.rpm
rpm -iv ipvsadm-1.24-7.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba ipvsadm.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh ipvsadm-*
安裝完畢
2. 完成GFS server的配置(該文章參考suran007 的GFS6.1 ON RHAS4 U2安裝文檔)
2.1 確保相關設備的主機名和IP地址的對應關係都在/etc/hosts中
例:
10.1.5.161 host1
10.1.5.162 host2
10.1.5.163 host3 #host3做爲gnbd的server
2.2 在host3上配置GFS經過gnbd進行export
啓動gnbd_serv進程
root@host3 # /sbin/gnbd_serv –v –n
導出設備
root@host3# gnbd_export -v -e gfs -d /dev/sdb1 –c
查看export狀態信息
root@host3# gnbd_export -v -l
完成GFS server,爲了使實驗更順利,建議將防火牆停掉 service iptables stop
3. 使用system-config-cluster工具對node1和node2進行配置
在node1的命令格式下輸入:system-config-cluster,進入配置界面
3.1而後在系統中,第一次配置會提示是否要建立配置文件/etc/cluster/cluster.conf,點擊"create "
3.2而後選擇 鎖機制,選擇dlm。
3.3添加cluster nodes。
點擊「add a cluster node",添加node1,quorum votes填1。
點擊「add a cluster node",添加node2,quorum votes填1。
3.4 添加fence設備
在」fence device"中,選擇「add a fence device",這裏添加的是"manual Fencing",名字任意,這裏寫」web"。
在"cluster Nodes->node1和node2」,中「manange fencing for this node",選擇」add a fence level"。
3.5 建立"failover domains"
在「manager resource->failover domains"中,」create a failover domain",名稱爲web
點擊「manager resource->failover domains->web","edit failover domain propertis",在"available cluster node2"中,將node1和node2都添加進取。
3.6 建立」resource"
"create a resource",選擇IP address,地址爲「10.1.5.169",後邊的monitor link要選中。
"create a resource",選擇script,name 爲"httpd",script爲"/etc/init.d/httpd"。
先保存,而後將cluster.conf傳到node2相同位置一份。下邊要配置gfs的一些resource,可是前提是cluster mananger的進程須要啓動才能進行設置。
4. 配置GFS參數
啓動cluster進程順序:
service ccsd start
service cman start
service fenced start
service clvmd start
service gfs start
service rgmanager start
而後在node1上,首先
modprobe gnbd
將gfs經過gnbd倒入:gnbd_import -v -i node3
檢查加載狀態:gnbd_import -v -l
modeprobe gfs
gfs_mkfs -p lock_dlm -t cluster1:gfs -j 2 /dev/gnbd/gfs 建立文件系統
在node2上重複此操做,只是不用再重作建立文件系統的操做
再打開system-config-cluster,
接着建立"resource"
"create a resource",選擇GFS,name "web_content",mount point:"/gfs",device:"dev/gnbd/gfs"。
5.配置service
因爲是爲了實現httpd的集羣,所以須要對/etc/httpd/conf/httpd.conf一些內容進行修改,包括
設置監聽地址爲floating ip:Listen 10.1.5.169:80
修改DocumentRoot 爲"/gfs/"
同時chkconfig httpd off,將httpd 的自啓動關閉
"service","create a service", name設爲httpd。
failover domain爲 web。
點」add a shared resource to this service" ,首先把ip address加入。
選擇」10.1.5.169 ip address share",而後再「attach a shared resource to the selecetion",分別添加剛纔設的script和gfs的resource。
保存配置,並複製該文件到node2。
分別從新啓動進程:
service rgmanager stop
service gfs stop
service clvmd stop
service fenced stop
service cman stop
service ccsd stop
service ccsd start
service cman start
service fenced start
service clvmd start
service gfs start
service rgmanager start
6. 開啓service
打開,system-config-cluster,若是剛纔的管理進程都正常的話,將會有cluster management的tab。
在service 中,點擊httpd 按"enable"啓動。
debug技巧:若是沒法正常啓動,嘗試着去掉一些resource,而後再看是否正常啓動,來定位故障。node