Knowledge w/o sharing is nothing!

HA Cluster on Centos

HA (High Availability) cluster is used to increase availability for any selected service on linux. Today I will show you how to install and configure basic software on Centos 7 – to get started with HA Cluster. First of all, we need two Centos 7 nodes installed in server mode and fully updated. For this example I will use these IP addresses as reference:

  • Node1 – 10.0.0.1
  • Node2 – 10.0.0.2

All commands from this point forward are run as root and on both nodes unless noted otherwise.

First lets install all the software we will need:

$ yum -y install corosync pacemaker pcs

Configure firewalld daemon to allow communications between cluster nodes:

$ firewall-cmd --permanent --zone=public --add-service=high-availability
$ firewall-cmd --reload

Set password for hacluster user, used for inter-node communications. Here you are asked twice to enter new password:

$ passwd hacluster

Enable and start pacemaker daemon:

$ systemctl enable pcsd.service
$ systemctl start pcsd.service

(Only Node1) Authenticate both nodes to a cluster (here we use the same hacluster username and password set a few steps back):

$ pcs cluster auth node1 node2

(Only Node1) Setup, enable and start cluster software:

$ pcs cluster setup --name hacluster node1 node2
$ pcs cluster enable --all
$ pcs cluster start --all

(Only Node1): Configure cluster to allow only two nodes and without STONITH device:

$ pcs property set stonith-enabled=false
$ pcs property set no-quorum-policy=ignore

(Only Node1): Verify cluster and configuration status:

$ pcs status
$ pcs status nodes
$ pcs status corosync
$ corosync-cmapctl | grep members
$ crm_verify -LV

And that would be it for main software installation. At this point you have a fully functional, but currently without any resources, working cluster. Later I will show you how to add resources to this cluster.