Configure LINUX Cluster | What is clustering? | INSTALLATION

What is clustering?

A Clustering is the use of multiple computers, multiple storage devices and redundant interconnections, which are used to form what appears to users as a single highly available system. Clustering is used for controlling the balance as well as for high availability of the resources.

Computer cluster technology can combine the multiple systems together to provide better system reliability and performance by creating a clustering environment. After creating cluster the operating systems divide the tasks among the available servers.

INSTALLATION:-

STEP-1 – Required Cluster Packages

In the first step we have to make sure that the following cluster packages are installed. If these packages are not installed then install them using yum_command.

  • [root@rh1 ~]# rpm -qa | egrep -i “ricci|luci|cluster|ccs|cman”
  • modcluster-0.16.2-28.el6.x86_64
  • luci-0.26.0-48.el6.x86_64
  • ccs-0.16.2-69.el6.x86_64
  • ricci-0.16.2-69.el6.x86_64
  • cman-3.0.12.1-59.el6.x86_64
  • clusterlib-3.0.12.1-59.el6.x86_64

STEP-2 – Start RICCI and Provide initial Password

In the next step, start the ricci service on both the nodes.

  • [root@rh1 ~]# service ricci start
  • Starting oddjobd:                                          [OK]
  • generating SSL certificates…  done
  • Generating NSS database…  done
  • Starting ricci:                                            [OK]
  • Assign password for the RICCI.
  • [root@rh1 ~]# password ricci

Changing password for user ricci.

  • New password:
  • Retype new password:
  • password: all authentication tokens updated successfully.

STEP-3 – Create Cluster on Active Node

Now, in the next step, we are creating a new cluster by using below command.

The command /etc/cluster/cluster.conf will create the cluster configuration file. If the configuration file is already exists, then it will replace the file with new configuration file.

  • [root@rh1 ~]# ccs -h rh1.mydomain.net –createcluster mycluster
  • rh1.mydomain.net password:
  • [root@rh1 ~]# ls -l /etc/cluster/cluster.conf
  • -rw-r—–. 1 root root 188 Sep 26 17:40 /etc/cluster/cluster.conf
Note: These commands are
running only from one node in the cluster and we are not yet ready to propagate
the changes to the other node on the cluster.

STEP-4 – Initial Plain cluster.conf File

After successfully creating the cluster, the cluster.conf file will look like the following:

  • [root@rh1 ~]# cat /etc/cluster/cluster.conf
  • <?xml version=”1.0″?>
  • <cluster config_version=”1″ name=”mycluster”>
  • <fence_daemon/>
  • <clusternodes/>
  • <cman/>
  • <fencedevices/>
  • <rm>
  • <failoverdomains/>
  • <resources/>
  • </rm>
  • </cluster>

STEP-5 – Add a Node to the Cluster

In the next step after successfully creating cluster, we need to add the clustering nodes to the cluster using the ccs command.

Add the first node rh1 to the cluster.

  • [root@rh1 ~]# ccs -h rh1.mydomain.net –addnode rh1.mydomain.net
  • Node rh1.mydomain.net added.

Now add second node rh2 to the cluster.

  • [root@rh1 ~]# ccs -h rh1.mydomain.net –addnode rh2.mydomain.net
  • Node rh2.mydomain.net added.

When the nodes are created, we can see them by using following command. This will also display the node id for the corresponding node.

  • [root@rh1 ~]# ccs -h rh1 –lsnodes
  • rh1.mydomain.net: nodeid=1
  • rh2.mydomain.net: nodeid=2

STEP-6 – cluster.conf File After Adding Nodes

Here we can also add the nodes to the cluster.conf file as shown below.

  • [root@rh1 ~]# cat /etc/cluster/cluster.conf
  • <?xml version=”1.0″?>
  • <cluster config_version=”3″ name=”mycluster”>
  • <fence_daemon/>
  • <clusternodes>
  • <clusternode name=”rh1.mydomain.net” nodeid=”1″/>
  • <clusternode name=”rh2.mydomain.net” nodeid=”2″/>
  • </clusternodes>
  • <cman/>
  • <fencedevices/>
  • <rm>
  • <failoverdomains/>
  • <resources/>
  • </rm>
  • </cluster>

STEP-7 – Add Fencing to Cluster

Fencing is the process by which we can isolate a node of a computer cluster or protecting shared resources when a node is facing some error. We can say that it is the disconnection of a node from shared storage. It cuts off I/O from shared storage, thus ensuring data integrity.

A fence device is a hardware device that can be used to cut a node off from shared storage.

Using following command we can enable fencing.

  • [root@rh1 ~]# ccs -h rh1 –setfencedaemon post_fail_delay=0
  • [root@rh1 ~]# ccs -h rh1 –setfencedaemon post_join_delay=25

Now, add a fence device. There are many fencing devices available. In virtual machine we can use fence_virt device.

  • [root@rh1 ~]# ccs -h rh1 –addfencedev myfence agent=fence_virt

Now, add fencing method. When the fencing device is created, we need to create the fencing method and add the hosts to the fencing method.

  • [root@rh1 ~]# ccs -h rh1 –addmethod mthd1 rh1.mydomain.net

Method mthd1 added to rh1.mydomain.net.

  • [root@rh1 ~]# ccs -h rh1 –addmethod mthd1 rh2.mydomain.net

Method mthd1 added to rh2.mydomain.net.

Finally, we can associate fence device to the method which is created above as shown below:

  • [root@rh1 ~]# ccs -h rh1 –addfenceinst myfence rh1.mydomain.net mthd1
  • [root@rh1 ~]# ccs -h rh1 –addfenceinst myfence rh2.mydomain.net mthd1

STEP-8 – After fencing cluster.conf file look like

Your cluster.conf will look like below after the fencing devices, methods are added.

  • [root@rh1 ~]# cat /etc/cluster/cluster.conf
  • <?xml version=”1.0″?>
  • <cluster config_version=”10″ name=”mycluster”>
  • <fence_daemon post_join_delay=”25″/>
  • <clusternodes>
  • <clusternode name=”rh1.mydomain.net” nodeid=”1″>
  • <fence>
  • <method name=”mthd1″>
  • <device name=”myfence”/>
  • </method>
  • </fence>
  • </clusternode>
  • <clusternode name=”rh2.mydomain.net” nodeid=”2″>
  • <fence>
  • <method name=”mthd1″>
  • <device name=”myfence”/>
  • </method>
  • </fence>
  • </clusternode>
  • </clusternodes>
  • <cman/>
  • <fencedevices>
  • <fencedevice agent=”fence_virt” name=”myfence”/>
  • </fencedevices>
  • <rm>
  • <failoverdomains/>
  • <resources/>
  • </rm>
  • </cluster>

STEP-9 – Add Failover Domain

For adding failover domain, we have to execute following command. Here i created a domain named as “failoverdomain”,

  • [root@rh1 ~]# ccs -h rh1 –addfailoverdomain failoverdomain ordered

After failover domain is created, add both the nodes to the failover domain:

  • [root@rh1 ~]# ccs -h rh1 –addfailoverdomainnode failoverdomain rh1.mydomain.net priority=1
  • [root@rh1 ~]# ccs -h rh1 –addfailoverdomainnode failoverdomain rh2.mydomain.net priority=2

To view all the nodes in the failover domain just use the following command.

  • [root@rh1 ~]# ccs -h rh1 –lsfailoverdomain
  • failoverdomain: restricted=0, ordered=1, nofailback=0
  • rh1.mydomain.net: 1
  • rh2.mydomain.net: 2

Follow US:

Leave a Reply

Your email address will not be published. Required fields are marked *