Empulse Group a collection of notes from a sys admin, musician, and father


RHCS: Setting up MySQL and NFS cluster

Red Hat Cluster Suite

Setting up MySQL and NFS cluster


This document is meant to be a guide to setting up MySQL and NFS cluster services with Red Hat Cluster Suite. A training environment is provided at training.racktools.us.

Axios Articles:

Configure Hostnames and Network:

Note that you will give up DRAC access to the cluster in our setups for fencing. Nic bonding is only for redundancy of the interfaces. In our VM training we do not currently have a way to fence devices the way DRAC would offer.

  • hostname server1.domain.com

  • /etc/sysconfig/network

  • /etc/hosts

Configure SAN:

Usually you will have SAN LUNs for NFS and MySQL services. In this training you will use devices /dev/sdb and /dev/sdc for storage.

  • create new partition with fdisk

  • refresh partition tables on both servers: partprobe

  • format to ext3 with mkfs.ext3

  • turn off fsck schedule with: tune2fs -c 0 -i 0d /dev/sdb1

Install software:

  • yum install cman rgmanager system-config-cluster fontconfig xorg-x11-fonts-Type1 xorg-x11-xauth perl-Crypt-SSLeay

Configure locations:

  • mkdir -p /san/mysql-fs
  • mkdir -p /san/nfs-fs


At this point we want to get MySQL running on the SAN mount, or /dev/sd{b,c} partition in this case, and create symlinks from the original directory location to the mount point.

  • Move /var/lib/{mysql,mysqllogs,mysqltmp} from one server to
    the SAN partition

  • Move /etc/my.cnf from one server to the SAN

  • symlink directories and my.cnf fron SAN to original locations
    on BOTH servers: ln -s /san/mysql-fs/mysql /var/lib/mysql


Portmap and NFS services need to be running on each node in order for NFS cluster services to start.

  • service portmap start; chkconfig portmap on;
  • service nfs start; chkconfig nfs on;
  • echo "portmap:" >> /etc/hosts.allow


You will create the cluster.conf file with the GUI tool 'system-config-cluster'. To enable X11 forwarding SSH to the server with the "-Y" or "-X" option.

# system-config-cluster

You will first be asked to name the cluster.

Now, with an empty configuration, you can start by adding your cluster nodes based on hostnames.

Cluster Nodes:

Click on the Cluster Nodes heading and then click the button "+Add a Cluster Node". Enter server name and set Quorum Votes to '1'. Do this for each node.

Fence Devices:

Now set up fencing for each server. Fencing is the disconnection of a node from shared storage. A fence device is a hardware device that can be used to cut a node off from shared storage. In our case we use DRAC as our fencing agent.

Source: https://access.redhat.com/kb/docs/DOC-30004

Click on the Fence Devices section and then click the button "+Add a fence device".

From the drop down list, select DRAC. The login details for DRAC in our environment are on the training page. In our Rackspace configs you would use the normal DRAC credentials.

Now, with the fencing deivces entered you need to set up fencing on each cluster node.

Under the Cluster Nodes section, highlight the first cluster node and then click the button "Managed Fencing For This Node".

Highlight the cluster node name and click the button "+Add a New Fence Level".

Now, highlight the new Fence-Level-1 and click the button "+Add a New Fence to this Level". Here you select the respective fencing device.

Managed Resources

Under the Resources section you will create resources for both the MySQL and NFS clusters. These resources are ip address, file systems, MySQL conf file, and NFS export and client settings.

Failover Domains

Set up a failover domain for each cluster service, MySQL and NFS.

If you want each server to be responsible for a particular service check "Prioritized List" and adjust priority of the cluster nodes inversely between failover domains.


First, set up the ip address for the cluster services. We will setup the MySQL cluster first.

Set up a resource for the MySQL file system. In our environment we are using /dev/sdb and /dev/sdc disks, but in our Rackspace cluster configs we would usually SAN luns presented as /dev/emcpowerb, etc.

Set up the MySQL configuration file, /etc/my.cnf, which will be symlinked on each server to the SAN mount or /dev/sd{b,c} in our environment.

Set up the ip address for NFS cluster.

Set up the NFS file system.

Now, the NFS export

The last resource will be the NFS client. Target will be the network you want to allow. Path is not optional at all and needs to be set. You can create more NFS client resources for each network you with.


Now that we have all of our resources set we need to chain them together to make each cluster service.

Under the Failover Domain drop down select the respective failover domain.

  • click "+Add a Shared Resource to this service" and select the ip address for the MySQL cluster service.
  • highlight the ip address you just added and click "+Add a Shared Resource to the selection" and select the MySQL file system.
  • highlight the file system resource, click "+Add a Shared Resource to the selection" and select the MySQL server.

The final cluster config tree should look similar to this:

Start services:

  • for i in cman rgmanager; do service $i start; chkconfig $i on; done


  • 'clustat' ~= Will show the status of the cluster
  • 'clusvcadm -R mysql-svc' ~= Will restart MySQL in place on the same server
  • 'clusvcadm -r mysql-svc -m ' ~= Will relocate MySQL to that node
  • 'clusvcadm -d mysql-svc' ~= Will disable MySQL
  • 'clusvcadm -e mysql-svc' ~= Will enable MySQL
  • Note: Cluster messages are logged to /var/log/messages.

Filed under: Linux Leave a comment
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.

Copyright © 2018 Empulse Group · Powered by WordPress
Lightword Theme by Andrei Luca Go to top ↑