Red hat linux

Setting up the Basic High-Availability Cluster on Centos/RHEL 7

Networking:

We have two nodes that are reachable by below Networks:
10.1.1.0/24 : Cluster heartbeat vlan.
172.16.1.0/24 : LAN with access to the Internal LAN network and Internet.

We have set the following hostnames:

We defined the Hostname and IP Address in “/etc/hosts” file(On both the nodes), as shown below;

To setting up IP Address and Hostname refer the below links.

Configure Static IP and Hostname On CentOS/RHEL7

Configure the Basic Cluster:
There is few steps to implement the Basic Cluster.

1) Install the Pacemaker configuration tools Packages.

Install the Package using yum command (Perform below command on both the nodes). Create the yum repository file with the name “ClusterHA.repo”

#vim /etc/yum.repos.d/ClusterHA.repo

# yum install pcs pacemaker fence-agents-all psmisc policycoreutils-python

2) Configure the Firewalld to Allow Cluster Components on both the nodes.

Using following command, you can enable the service of high-availability on firewall.

3) Start and enable the pcsd daemon on each node.

Perform below command on both nodes to start and enable the pcsd daemon.

Note1: “enable” option is used to Activate the pcsd services at boot.

Note2: This step will be perform on both the nodes.

4) Create the Cluster.

Before creating the cluster we have to set up the authentication needed for pcs(on both the nodes), using below command.

# echo | passwd –stdin hacluster

Node1:

Sample Output:

Node2:

Sample Output:

#pcs cluster auth NODE1 NODE2 -u hacluster -p Cluster%P@ssWD –force

Now create a cluster and populate it with some nodes.

# pcs cluster setup –force –name pacemaker1 node1 node2

Note: The name of the Cluster cannot exceed 15 characters. we are use ‘AsteriskCluster’.

5) Start the Cluster on all the Nodes.

We use the “pcs” command to start the cluster.

#pcs cluster start –all

Note: if “–all” option will start the cluster on all configured nodes.

To check the cluster status following command is used;

Note: You can also use the ‘crm_mon -1’ command to check the status of service running on Cluster.

If you check the above status its showing “no stonith devices and stonith-enabled is not false” warning. We will disable the STONITH for the time being, To disable the STONITH following command is used.

Fencing is the disconnection of a node from the cluster’s shared storage. Fencing cuts off I/O from shared storage, thus ensuring data integrity. The cluster infrastructure performs fencing through the fence daemon, fenced. In pcs based cluster, By default pacemaker enables STONITH/ Fencing in an order to protect the data.

Note: Perform above command on one of the Cluster Node.

One of the Important thing, When we deploy Pacemaker is in a 2-node configuration. quorum as a concept makes no sense in this scenario because you only have it when more than half the nodes are available, so we’ll disable it too, using following command.

Lets add the Cluster Resource.

#pcs resource create VIP ocf:heartbeat:IPaddr2 ip=172.16.1.10 cidr_netmask=32 op monitor interval=30s
Where;
“VIP” is the name the service will be known as.
“ocf:heartbeat:IPaddr2” tells heartbeat which script to use.
“op monitor interval=30s” tells Pacemaker to check the health of this service every 2 minutes by calling the agent’s monitor action.

For more Examples of pcs resource Command link here.

Now check the status of the Cluster.

Note: We used IPaddr2 and not IPaddr because IPaddr used for manages virtual IPv4 addresses & it is a portable version and IPaddr2 used for manages virtual IPv4 addresses.

Leave a Reply

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