首页 > 代码库 > linux双机GFS的配置
linux双机GFS的配置
1、两台服务器安装如下包:
apr-1.2.7-11.el5_3.1.x86_64.rpm
apr-util-1.2.7-11.el5.x86_64.rpm
cman-2.0.115-34.el5.x86_64.rpm
cman-devel-2.0.115-34.el5.i386.rpm
cman-devel-2.0.115-34.el5.x86_64.rpm
gfs2-utils-0.1.62-20.el5.x86_64.rpm
gfs-utils-0.1.20-7.el5.x86_64.rpm
gmp-4.1.4-10.el5.x86_64.rpm
httpd-2.2.3-43.el5.x86_64.rpm
ipvsadm-1.24-10.x86_64.rpm
kernel-xen-2.6.18-194.el5.x86_64.rpm
kmod-gfs-0.1.34-12.el5.x86_64.rpm
kmod-gfs-xen-0.1.34-12.el5.x86_64.rpm
lvm2-cluster-2.02.56-7.el5.x86_64.rpm
openais-0.80.6-16.el5.x86_64.rpm
perl-Net-Telnet-3.03-5.noarch.rpm
perl-XML-LibXML-1.58-6.x86_64.rpm
perl-XML-LibXML-Common-0.13-8.2.2.x86_64.rpm
perl-XML-NamespaceSupport-1.09-1.2.1.noarch.rpm
perl-XML-SAX-0.14-8.noarch.rpm
pexpect-2.3-3.el5.noarch.rpm
php-5.1.6-27.el5.x86_64.rpm
php-cli-5.1.6-27.el5.x86_64.rpm
php-common-5.1.6-27.el5.x86_64.rpm
piranha-0.8.4-16.el5.x86_64.rpm
postgresql-libs-8.1.18-2.el5_4.1.x86_64.rpm
ql-dynamic-tgt-lun-disc-2.3.tgz
rgmanager-2.0.52-6.el5.x86_64.rpm
system-config-cluster-1.0.57-3.noarch.rpm
rpm -ivh * --force
2、两台服务器修改主机名
/etc/sysconfig/network
/etc/init.d/network restart
3、修改/etc/lvm/lvm.conf中的locking_type值为3:locking_type = 3
4、在两个节点上配置集群
<?xml version="1.0"?>
<cluster config_version="2" name="gfs_cluster">
<fence_daemon post_fail_delay="0" post_join_delay="3"/>
<clusternodes>
<clusternode name="dxp1" nodeid="1" votes="1">
<fence/>
</clusternode>
<clusternode name="dxp2" nodeid="2" votes="1">
<fence/>
</clusternode>
</clusternodes>
<cman expected_votes="1" two_node="1"/>
<fencedevices/>
<rm>
<failoverdomains/>
<resources/>
</rm>
</cluster>
service cman start
service clvmd start
service gfs start
service rgmanager start
5、一个节点
pvcreate /dev/mapper/mpath1
vgcreate /dev/vggfs /dev/mapper/mpath1
lvcreate -L 95G -n lvgfs vggfs
在另一节点
vgscan
lvscan
gfs_mkfs -p lock_dlm -t gfs_cluster:datagfs -j 10 /dev/vggfs/lvgfs
其中:gfs_cluster是cluster name
datagfs是gfs类型的文件系统的名字,是唯一的。
[root@localhost dev]# gfs_mkfs -p lock_dlm -t gfs_cluster:datagfs -j 10 /dev/vggfs/lvgfs
This will destroy any data on /dev/vggfs/lvgfs.
Are you sure you want to proceed? [y/n] y
Device: /dev/vggfs/lvgfs
Blocksize: 4096
Filesystem Size: xxxxxx
Journals: 10
Resource Groups: 1996
Locking Protocol: lock_dlm
Lock Table: gfs_cluster:datagfs
Syncing...
All Done
创建文件系统和挂载:
6、mkdir /data
mount -t gfs /dev/vggfs/lvgfs /data