Building RHEL7 Cluster Part-I

Hello Folks,

It has been long time, I could not create any post about the clustering with RHEL7. It uses Pacemaker as a high-availability cluster resource manager.

In this post, It will be used two-node cluster. Each of the node has been configured to resolve the hostnames into the IP addresses. Also, each node has been configured the sync its time from the outside world ntp servers. It is depicted in the Figure-1.


pck1 –


It is used ntpd deamon, instead of chronyd.

Figure-1 Two-Node Cluster with Pacemaker


Installing Necessary Packages:

On both nodes;

Configuring Firewall:

On both nodes;

Disabling Selinux:

On both nodes;

Staring and Enabling Cluster Service:

On either node.

Configuring Cluster:

On both node set password for the user hacluster

On either node authenticate the nodes.

Named the Cluster:

I named cluster as LATAM_GW

Starting Cluster

On either node.

You can also start the specific node instead of all nodes in the cluster.

Viewing the version of cluster software:

Checking current cluster Configuration:

Cluster configuration stored in XML format. You can view the current cluster configuration with “pcs cluster cib”.

Adding Resource to Cluster:

In this post, It will be built High Available(Active-Passive) Apache Web Server. For this purpose first resource that we need to create is the ClusterIP. In other words Floating IP. A floating IP address is used to support failover in a high-availability cluster. The cluster is configured such that only the active member of the cluster “owns” or responds to that IP address at any given time.

On either node.

Configuring Apache for the Active-Passive cluster(HA)

On both nodes. Install httpd and wget on both nodes. wget is necessary tool which used by the resource agent to check the healthiness of the node.

Create a webpage on both nodes like below.

On first node:

Create index.html in the /var/www/html

On second node.

Create index.html in the /var/www/html

Configure apache for server-status:

This pages will be requested by the cluster resource agent to check the healthiness of nodes.

On first node; create configuration into the /etc/httpd/conf.d/status.conf

On second node; create configuration into the /etc/httpd/conf.d/status.conf

Creating Resource for the Apache

Only either one.

As you may now, we have two resources now. One is the ClusterIP and the other one is LATAMWEBGW. If you do not do anything special, Cluster Manager load balances these to resources by running on the different nodes, that we do not want that. So, these two resources are dependent on each other. We need to add some constraints solve this problem.

Creating colocation constraint:

Colocation constraint tells the cluster manager that location of one resource is depended location of another resource.

On either node

By issuing the command above; we told cluster manager that LATAMWEBGW resource must be in the same node as ClusterIP resource.

Latest status of our cluster:

Creating Order Constraint:

We may have still an issue when sending a request to the our Web Server. Other than, colocation constraint, we also need to tell the cluster software to order of the resources to be started. It is called order constraint.

By issuing the command above we are telling the cluster manager to which resource to be started first. After we configured constraints, we can test our Web Server if it handles the requests properly.

Relocating the Resource to Another Node:

Sometimes we need to relocate the resources to the other node in order to maintain or upkeep of the nodes.

As you may see current resources running on pck1, which is the first node. Let’s relocate it to the pck2 which is the second node.

As you see all LATAMWEBGW resource is now running on pck2 which is the second node.


This is the end of  first part of the RHEL7 clustering part. We have not yet configured fencing, which is very crucial part of the clustering. In the next post we are going to configure fencing, stickiness and other cluster settings.

Happy Clustering 🙂