Newest Downloads

Mar.18

  [zenoss@zenoss2 ~]$ python Zenoss_Template_Manager.py -husage: Examples: python Zenoss_Templa...

HowTo setup GFS2 with Clustering
Clustering HowTo's - RedHat Clustering
Written by Allen Sanabria   
Friday, 14 August 2009 11:48

In my last project at work, I had to replace NFS with GFS2 and Clustering. So in this tutorial I will show you how to create a Red Hat or CentOS cluster with GFS2. I will also show you how to optimize GFS2 performance in the next HowTo, because you will quickly notice some loss of performance until you do a little optimization first.I will 1st show you how do build a Cluster with GFS2 on the Command Line and in the next tutorial I will show you how to do the same thing using Conga.

In this tutorial I am using 3 CentOS Virtual Machines running CentOS 5.3 in VMware ESX 3.5. For the GFS2 File System I am using a vmdk built with the thick option, that is shared among all the Virtual Machines. You also can use iscsi or fiber... This option is up to you.

Always make sure your iptables (If you know the port's and protocols for clustering, then add it to iptables ) and selinux is OFF. If not you will run into issues.

The 3 machines I am using are called

  • gfs1 == 192.168.101.100
  • gfs2 == 192.168.101.101
  • gfs3 == 192.168.101.103

Since I'm using VMware ESX for the 3 machines above I will also be using vmware for fencing. The info is below for my test setup

  • ESX Host Name == esxtest
    ESX IP Address == 192.168.101.50
  • ESX user login info below
    login == esxuser
    password == esxpass
  • ESX admin login info below
    login == root
    password == esxpass

 

The 1st command you need to know for creating and modifying your cluster is the 'ccs_tool' command.

Below I will show you the necessary steps to create a cluster and then the GFS2 filesystem

  1. First step is to install the necessary RPM's..
    yum -y install modcluster rgmanager gfs2 gfs2-utils lvm2-cluster cman
  2. Second step is to create a cluster on gfs1
    ccs_tool create GFStestCluster
  3. Now that the cluster is created, we will now need to add the fencing devices.
    ( For simplicity you can just use fence_manual for each host.. ccs_tool addfence -C gfs1_ipmi fence_manual )
    But if you are using VMware ESX like I am you should use fence_vmware like so...
    ccs_tool addfence -C gfs1_vmware fence_vmware ipaddr=esxtest login=esxuser passwd=esxpass vmlogin=root vmpasswd=esxpass port="/vmfs/volumes/49086551-c64fd83c-0401-001e0bcd6848/eagle1/gfs1.vmx"
    ccs_tool addfence -C gfs2_vmware fence_vmware ipaddr=esxtest login=esxuser passwd=esxpass vmlogin=root vmpasswd=esxpass port="vmfs/volumes/49086551-c64fd83c-0401-001e0bcd6848/gfs2/gfs2.vmx"
    ccs_tool addfence -C gfs3_vmware fence_vmware ipaddr=esxtest login=esxuser passwd=esxpass vmlogin=root vmpasswd=esxpass port="/vmfs/volumes/49086551-c64fd83c-0401-001e0bcd6848/gfs3/gfs3.vmx"
  4. Now that we added the Fencing devices, it is time to add the nodes..
    ccs_tool addnode -C gfs1 -n 1 -v 1 -f gfs1_vmware
    ccs_tool addnode -C gfs2 -n 2 -v 1 -f gfs2_vmware
    ccs_tool addnode -C gfs3 -n 3 -v 1 -f gfs3_vmware
  5. Now we need to copy this configuration over to the other 2 nodes from gfs1 or we can run the exact same commands above on the other 2 nodes..
    scp /etc/cluster/cluster.conf root@gfs2:/etc/cluster/cluster.conf
    scp /etc/cluster/cluster.conf root@gfs3:/etc/cluster/cluster.conf
  6. You can verify the config on all 3 nodes by running the following commands below..
    ccs_tool lsnode
    ccs_tool lsfence
  7. You are ready to proceed with starting up the following daemons on all the nodes in the cluster, once you either copied over the configs or re ran the same commands above on the other 2 nodes
    /etc/init.d/cman start
    /etc/init.d/rgmanager start
  8. You can now check the status of your cluster by running the commands below...
    clustat
    cman_tool status
  9. If you want to test the vmware fencing you can do so by doing the following.. ( run the command below on the 1st node and use the 2nd node as the node to be fenced )
    fence_vmware -a esxtest -l esxuser -p esxpass -L root -P esxpass -n "/vmfs/volumes/49086551-c64fd83c-0401-001e0bcd6848/gfs2/gfs2.vmx" -v
  10. Before we start to create the LVM2 volumes and Proceed to GFS2, we will need to enable clustering in LVM2.
    lvmconf --enable-cluster
  11. Now it is time to create the LVM2 Volumes...
    pvcreate MyTestGFS /dev/sdb
    vgcreate -c y mytest_gfs2 /dev/sdb
    lvcreate -n MyGFS2test -L 5G mytest_gfs2
    /etc/init.d/clvmd start
  12. You should now also start clvmd on the other 2 nodes..
  13. Once the above has been completed, you will now need to create the GFS2 file system.. Example below..
    mkfs -t <filesystem> -p <locking mechanism> -t <ClusterName>:<PhysicalVolumeName> -j <JournalsNeeded == amount of nodes in cluster> <location of filesystem>
    mkfs -t gfs2 -p lock_dlm -t MyCluster:MyTestGFS -j 4 /dev/mapper/mytest_gfs2-MyGFS2test
  14. All we need to do on the 3 nodes, is to mount the GFS2 file system.
    mount /dev/mapper/mytest_gfs2-MyGFS2test /mnt/
  15. Once you mounted your GFS2 file system You can the following commands..
    gfs2_tool list
    gfs2_tool df


Now it is time to wrap it up with some final commands...

  1. Now that we have a fully functional cluster and a mountable GFS2 file system, we need to make sure all the necessary daemons start up with the cluster..
    chkconfig --level 345 rgmanager on
    chkconfig --level 345 clvmd on
    chkconfig --level 345 cman on
    chkconfig --level 345 gfs2 on
  2. If you want the GFS2 file system to be mounted at startup you can add this to /etc/fstab..
    echo "/dev/mapper/mytest_gfs2-MyGFS2test /GFS gfs2 defaults,noatime,nodiratime 0 0" >> /etc/fstab

In the next up coming tutorials I will show you how to do the same as above but with the Red Hat Conga gui and I will also show you how to optimize your GFS2 Cluster setup.



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Comments
Search RSS
MrIch   |Registered |2009-10-28 02:01:47
Hi Allen,

thanks for your great tutorial.

Unfortunately I am not able to
execute "/etc/init.d/cman start" on any cluster memeber. We are using
CentOS 5.4 here.

[root@node206 ~]# /etc/init.d/cman start
Starting
cluster:
Loading modules... done
Mounting configfs... done
Starting
ccsd... done
Starting cman... failed
/usr/sbin/cman_tool: Node is already
active

[FAILED]

/var/log/messages:
Oct 28 13:54:49 node206 ccsd[2943]: Starting ccsd
2.0.115:
Oct 28 13:54:49 node206 ccsd[2943]: Built: Sep 3 2009 23:286
Oct 28
13:54:49 node206 ccsd[2943]: Copyright (C) Red Hat, Inc. 2004 All rights
reserved.
Oct 28 13:54:50 node206 ccsd[2943]: Initial status:: Inquorate
Oct 28
13:54:50 node206 ccsd[2943]: cluster.conf (cluster name = GFStestCluster,
version = found.
Oct 28 13:54:50 node206 openais[2590]: [TOTEM] The consensus
timeout expired.
Oct ...
dynasty   |SAdministrator |2009-10-28 04:30:24
Could you post this information here.
http://www.linuxdynasty.org/forums/Clustering/R...
Also could you post the output of these commands in the forums as
well..

clustat
cman_tool status
ccs_tool lsnode
ccs_tool lsfence
ansilh  - Thank U very much     |Registered |2009-10-30 06:07:46

hi Allen

I'm really happy now .
I didn't have any more resource
while starting RHCS in VmWare.

Now i've a two node cluster with
GFS2 file system .

Great post...really...
dynasty   |SAdministrator |2009-10-30 06:38:32
Thank you so much for the compliment... This is the reason why I write these
howtos.

Makes me happy to know I helped someone.
Cadarik  - Great tutorial, thank you!   |Registered |2009-12-11 15:22:03
Hi Allen,

Thanks for your great tutorial and particulary for the performances
tuning part . I have got to setup a GFS architecture and i have got some
questions to ask you

How much data do your production architecture
manage?

How many concurrent connections do your production architecture
support?

Is the vmware_fence agent stable and suitable for a production
environment?

Thanks in advance.

Best regards.

Cadarik
amitabhmca   |Registered |2010-02-21 08:40:08
HI,

I have vmware server running in my laptop.

Could you please tell me
the procedure to implement GFS using vmware server..

thanks,
Amiatbh
Hermann  - cman hangs   |Registered |2010-03-14 12:40:09
Hi

I am trying to configure 2 VMware servers to use the same disk using GFS.


I am using Centos 5.4 with the latest patches.
I installed the groups
"Clustering" and "Cluster Storage"

I then followed the
instruction above and also added "" to the config because this is a 2
node cluster, but cman hangs at the fencing when I run the start script.


#
/etc/init.d/cman start
Starting cluster:
Loading modules... done
Mounting
configfs... done
Starting ccsd... done
Starting cman... done
Starting
daemons... done
Starting fencing...
dynasty   |SAdministrator |2010-03-14 14:51:03
Please post help questions here..
http://www.linuxdynasty.org/forums/Clustering/R...

Check and make sure iptables is not running.
Hermann  - Cman hangs resolved   |Registered |2010-03-15 03:37:36
Hi

The node that hanged had selinux enabled. After I disabled it and rebooted
it started.

Regards
Hermann
dynasty   |SAdministrator |2010-03-15 03:52:57
Sweet, I completely forgot about se-linux. Usually people forget to turn of
iptables.

I am glad you figured it out.
dynasty   |SAdministrator |2010-03-15 07:46:52
I made sure to add the look for iptables and se-linux in the doc..

Hopefully
this will make other life easier.
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Monday, 15 March 2010 11:45