RHEL Cluster Pacemaker Corosync
RHEL Cluster Pacemaker Corosync
Chapter 1:- Introduction and basic difference from previous RHEL cluster and latest RHEL
Cluster.
Red hat cluster allows you to configure and manage group of resources (computer/servers) to work together to provide
high availability and form group called cluster.
From RHEL7 onward red hat uses pacemaker as default cluster resource manage. Corosync is open source cluster engine
which is responsible to manage the cluster interconnect and maintains the same cluster configuration across all the
cluster nodes. i.e.
➔ Default command utility is “pcs” and “pcsd is pacemaker web utility tool.
Corosync engine help to maintain cluster configuration in all nodes and maintain consistency.
A – Resource Agent: - Resource agent are scrips that help to stop start and monitor resource configured in cluster.
B – Resource Manager: - Pacemaker provides brain that processes & reacts to event regarding cluster. This event can be
joining or leaving node in cluster. Resource events caused by failures, maintenance and scheduled activities and other
administrative actions. Resource manager is nothing but “pacemaker”.
HA Service
Pacemaker
Resource
Agent
CoroSync
Cluster
Pacemaker is responsible is to provide maximum availability of cluster resource and service by detecting and recovering
from node and resource level failure.
It uses massaging and membership capabilities provided by corosync to keep the resource available on any of the cluster
node.
Features:-
CIB
STONITHd CRMd
CoroSync
Pacemaker centralize all cluster decision making by electing one of CRMd instance to act as master. If one CRMd
instance fails it automatically start new instance.
PEngine used CIB XML file and determine cluster state and recalculate the ideal cluster state based upon
unexpected results.
If any node misbehave, it better to turnoff instead of corrupting the data on shared storage.
COROSYNC:-
Corosync is an open source cluster engine which communicates with multiple cluster nodes and updates the
cluster information database (cib.xml) frequently. In previous red hat cluster release, “cman” was responsible for cluster
interconnect, messaging and membership capabilities. Pacemaker also supports “heartbeat” which is another open
source cluster engine (Not available in RHEL 7), but can be used in RHEL6.
Hardware requirement:-
1 – 2 CPU
2 – 4 GB Memory
3 – NFS (For shared storage)
Installation:-
Node 1 Node 2
CoroSync
# passwd hacluster
Cluster Autheticate
Create Cluster
# pcs status
# corosync-cfgtool -s
# pcs status
# crm_verify –L –V
Disable Fencing
Pacemaker will have one agent per resource to handle its operation. Resource type could be filesystem, IP address,
database, application and more. Resource agent is responsible to monitor, stop, start, migrate, promote, demote
resources whenever required. Most of the resource agents are compliant to Open Cluster Framework (OCF).
Let’s add one IP resource to the existing cluster and then we will get in to the detailed explanation of command options.
# pcs status
Where,
Where,
Resource Providers:-
The second field when specifying resource agent is resource provider (exp. heartbeat for OCF resource standard). It help
the cluster to identify which OCF namespace the resource script is in.
heartbeat
openstack
pacemaker
This is last 3rd parameter in while declaring resource agent. To check available agent for resource use below command.
Project: - Let create small cluster with 3 resource IP, Filesyestem and Apache.
Filesystem:-
# pvcreate /dev/sdb
# vgcreate webvg01 /dev/sdb
# lvcreate –L 1G –n weblv01 webvg01
# mkfs.ext4 /dev/webvg01/weblv01
# mkdir /opt/webhost/web01
# mount /dev/webvg01/weblv01 /opt/webhost/web01
2 - Apache:-
3 - IP:-
IP addr → 192.168.XX.XX
Subnet → 255.255.255.0
You have to change lvm.conf file “use_lvmetad” value to “0”. This is mandatory when you use pacemaker or configure
LVM in pacemaker as resource.
You can also prevent auto activation of volume group after reboot. This can be done changing parameter “volume_list”
in lvm.conf.
You can also rebuilt you initramfs” image to ensure that you volume group wont activate after reboot, use below
command. (take backup of previous image)
# dracut –H –f /boot/initramfs-$(uname -r).img $(uname -r)
Volume Group
6 - Before adding apache resource please update httpd.conf file for webhosted.
# pcs status
# pcs status
# pcs resource
[If you find any resource found disable, please enable it using below command]
Or
Project 2:- Pacemaker – Configure HA KVM guest, it should migrate KVM guest VM to another In case f any failure on
base node.
Here concept is to provide high availability to KVM guest, like Vmware HA. Migration should be done with minimal
downtime from one node to another. Here KVM guest will work like resource in cluster.
Pre-requirements:-
Guest Failover
VM
Node Node
1 Live Migration 2
NFS NFS
Shared Storage
2 – Ensure your KVM configuration is already ready in system. Copy guest domain configuration for (xml) to NFS path.
# cd /etc/libvirt/qemu/ ; ls -l
# cp centos_guest_node1.xml /kvmpool/qemu_config/ ; ls –l
# pcs status
3 – To manage KVM guest machine we need to use ‘VirtualDomain’ agent resource. Creating resource for KVM guest.
# pcs status
Project 3:- suppose you have two nodes i.e. node1 and node2 as cluster node and you have to do maintenance on
both the nodes with high availability.
Yes, it’s possible to do maintenance activity each node one by one to ensure services running cluster with highly
available.
2 – If all ok, move Cluster services running from node1 to node2 and bring node1 in maintenance mode(standby).
As soon as you execute above command services running on node1 will first start migrating on node2.
# pcs status
OR
# corosync-quorumtool
# pcs status
Note:- If you don’t want to move resource group automatically, then you can BAN that resource group
B – Both the node need maintenance for some critical software upgrade.
# pcs status
4 - Once you done with maintenance activity, you can start services and remove maintenance mode
# pcs status