CentOS 6 Cluster - Quick & Dirty

This paper is an overview of the commands needed to setup a basic working cluster quickly on CentOS 6 assuming the nodes are hosted using VMWare. You should be able to follow the commands top down and end up with a completed cluster.

It is assumed you have an iSCSI server in place to host the GFS filesystem shared by the clustered nodes.

Also note this paper disables selinux which is not recommended, again this paper is a quick example of getting a cluster to stand up. For more information about SELinux see the links at the bottom of this page.

Fencing will need to be setup in your cluster, this paper does not describe the various fencing methods available. Please don't use this example as a basis for a production cluster. This paper should be used for reference only.

  • Install the needed packages % yum groupinstall "High Availability" "Resilient Storage" % yum groupinstall "High Availability Management" (head node only) % yum install iscsi-initiator-utils
  • Add the following ports to /etc/sysconfig/iptables 5404, 5405 UDP corosync/cman (Cluster Manager) 11111 TCP ricci (propagates updated cluster information) 21064 TCP dlm (Distributed Lock Manager) 16851 TCP modclusterd 8084 TCP luci (head node for conga access) % service iptables restart
  • Edit /etc/selinux/config to disable selinux SELINUX=disabled % setenforce 0
  • Set the password for ricci / configure the appropriate services for startup % passwd ricci Changing password for user ricci. New password: % chkconfig ricci on | service ricci start % chkconfig luci on | service luci start (head node only) % chkconfig cman on | chkconfig clvmd on | chkconfig rgmanager on % chkconfig modclusterd on % chkconfig NetworkManager off | service NetworkManager stop
  • Set your IP static if it's not already % system-config-network
  • Edit /etc/hosts on all nodes to be the same, example: localhost.localdomain localhost node1.localdomain.com node1 node2.localdomain.com node2 iscsi.localdomain.com iscsi Make sure does not point to the hostname (both ipv4 and ipv6)
  • Point your browser to the conga interface to create the cluster https://node1.localdomain.com:8084 Enter the root username and password
  • Create the GFS shared filesystem from any of the nodes % iscsiadm -m discovery -t sendtargets -p iscsi.localdomain.com (both nodes) % service iscsi restart (both nodes) % fdisk /dev/sdb (create a lvm partition) % vgcreate stor_vg /dev/sdb1 % lvcreate -L +4.95G -n stor_lv stor_vg % mkfs.gfs2 -p lock_dlm -t Hydra:storage -j 4 /dev/mapper/stor_vg-stor_lv (substitute Hydra with the name of your cluster)
  • Update /etc/fstab to mount the filesystem to /storage at startup /dev/mapper/stor-vg/stor-lv /storage gfs2 defaults 0 0
  • Example FTP service configuration using conga % yum install vsftpd (on all cluster nodes) Name: srv_ftp Recovery Policy: Relocate Resource: IP Address: Script Resource: /etc/init.d/vsftpd Make sure all configuration files on all nodes are identical for each service I advise restarting the cluster after adding the service
  • Links & Notes

  • RHEL 6 Global File System 2 (GFS)
  • High Availability Add-On Overview
  • Cluster FAQ
  • Managing HA Services with clusvcadm