GFS与RHCS安装记录
硬件环境 :双 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,然后再看是否正常启动,来定位故障。