Home » Centos/RHEL » High Availability linux cluster with Pacemaker and Corosync

High Availability linux cluster with Pacemaker and Corosync

Corosync

Corosync is an open supply Cluster Engine. it’s miles virtually a communication gadget that enables or extra Linux Cluster nodes to transfer statistics among them. Corosync is continually listening on designed port number wherein Linux Cluster nodes are sending information. Corosync verbal exchange machine permits all of the nodes to recognise the precise state of each other in any respect time. In case one of system nodes gets fail in Linux Cluster this records may be at once transferred to different still exsisting Linux Cluster nodes.

Pacemaker

Pacemaker is an open source high availability resource manager. because the name says, Pacemaker manages assets. Pacemaker empowers detection and recovery of utility and gadget screw ups. Pacemaker keeps the configuration of all assets Linux Cluster will manage as additionally all family members between the Machines and assets. In case one of system nodes gets fail in Linux Cluster Pacemaker will detect this and begin configured resources on one of the othe available Linux Cluster nodes.
In this guide i am going to setup high availability linux cluster with Pacemaker and Corosync.

Setup DNS record for cluster nodes as well as NTP time synchronization.
172.22.0.60 – node1.linuxpcfix.com
172.22.0.61 – node2.linuxpcfix.com

[root@linuxpcfix~]# yum install ntpd

Setup and enable HA-Clustering repo from opensuse to install require packages on the serverm, So create a repo file and append the following lines.

[root@linuxpcfix~]# vi /etc/yum.repos.d/ha-clustering.repo
[haclustering]
name=HA Clustering
baseurl=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/
enabled=1
gpgcheck=0

Then run the following command to install packmaker, crm shell and corosync on both available nodes.

[root@linuxpcfix~]# yum install crmsh pacemaker corosync

Now generate the corosync authkey by using corosync-keygen command.

[root@linuxpcfix~]# corosync-keygen

after complete the corosync-keygen process you can find the new authkey in /etc/corosync/ directory with named authkey.

Copy the newly generated authkeys to secondary cluster node.

[root@linuxpcfix~]# rsync -avr /etc/corosync/authkey root@node2.linuxpcfix.com:/etc/corosync

Change the directory /etc/corosync/ to create corosync configuration file.

[root@linuxpcfix~]# cd /etc/corosync/
[root@linuxpcfix~]# vim corosync.conf

And append the following lines in corosync.conf file.

compatibility: whitetank

totem {
version: 2
secauth: off
interface {
member {
memberaddr:172.22.0.60
}
member {
memberaddr:172.22.0.61
}

ringnumber: 0
bindnetaddr: 172.22.0.60
mcastport: 5405
ttl: 1
}
transport: udpu
}

logging {
fileline: off
to_logfile: yes
to_syslog: yes
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off

}
}

# this will start Pacemaker processes
service {
ver: 0
name: pacemaker
}

copy the corosync.conf file on secondary node also.

[root@linuxpcfix~]# /usr/bin/scp /etc/corosync/corosync.conf root@node2.linuxpcfix.com:/etc/corosync/

Note: Change the ip address of node2.linuxpcfix.com

Then start the corosync and packemaker on both servers node

[root@linuxpcfix~]# service corosync start
[root@linuxpcfix~]# service pacemaker start

Now check the cluster status

[root@linuxpcfix~]# netstat -na | grep 5405
[root@linuxpcfix~]# crm status
[root@linuxpcfix~]# crm configure show

Note:- You can copy sample unicast configuration file as given below.
[root@linuxpcfix~]# cp /etc/corosync/corosync.conf.example.udpu /etc/corosync/corosync.conf

About

I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry since more than 14 years.

One thought on “High Availability linux cluster with Pacemaker and Corosync

Leave a Reply

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

*
*

Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud