Installing Pacemaker Corosync Cluster on RHEL 7
Installing Pacemaker Corosync Cluster on RHEL 7
RHEL 7.9
pacemaker-1.1.21-4.el7.x86_64
corosync-2.4.5-4.el7.x86_64
| Object | Value |
|---|---|
| Hostname | nood1, node2 |
| Public NICs | bond0, Mode 1, eno1, eno2 |
| Node Public IP | 192.168.3.249, 192.168.3.250 |
| Private NICs | bond1, Mode 1, eno3, eno4 |
| Node Private IP | 100.100.100.249, 100.100.100.250 |
| Cluster Name | my_cluster |
| BusType | iSCSI, 192.168.3.112 |
| Shared Disk 1 | 5GB |
| Shared Disk 2 | 10GB |
Setting Media ISO YUM Repository
・ Configuring Yum Repositories
Configuring Network
・ Configuring Network Bonding on RHEL 7,8
nmcli con add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup,miimon=1000" |
Configuring hosts resolve.
cat >>/etc/hosts <<EOF |
Installing the Red Hat High Availability Add-On software
-
On each node in the cluster, install the Red Hat High Availability Add-On software packages along with all available fence agents from the High Availability channel.
yum -y install pcs pacemaker corosync fence-agents-all
-
If you are running the firewalld daemon, execute the following commands to enable the ports that are required by the Red Hat High Availability Add-On.
firewall-cmd --permanent --add-service=high-availability
firewall-cmd --add-service=high-availability -
In order to use pcs to configure the cluster and communicate among the nodes, you must set a password on each node for the user ID hacluster, which is the pcs administration account. It is recommended that the password for user hacluster be the same on each node.
echo "hacluster" | passwd --stdin hacluster
-
Before the cluster can be configured, the pcsd daemon must be started and enabled to boot on startup on each node. This daemon works with the pcs command to manage configuration across the nodes in the cluster.
On each node in the cluster, execute the following commands to start the pcsd service and to enable pcsd at system start.
systemctl start pcsd.service
systemctl enable pcsd.service -
Authenticate the pcs user
haclusterfor each node in the cluster on the node from which you will be running pcs.pcs cluster auth node1-hb node2-hb
Cluster Creation
-
Execute the following command from node1-hb to create the two-node cluster cluster that consists of nodes node1-hb and node2-hb. This will propagate the cluster configuration files to both nodes in the cluster. This command includes the
--startoption, which will start the cluster services on both nodes in the cluster.pcs cluster setup --start --name my_cluster node1-hb node2-hb
-
Enable the cluster services to run on each node in the cluster when the node is booted.
pcs cluster enable --all
-
You can display the current status of the cluster with the pcs cluster status command.
pcs cluster status
Configuring Quorum Node
Install corosync-qdevice on the nodes of an existing cluster.
~]# yum install corosync-qdevice |
Install pcs and corosync-qnetd on the quorum device host.
~]# sudo cat >>/etc/hosts <<EOF |
Add the quorum device to the cluster.
~]# pcs cluster auth node-quorum |
Configuring STONITH
Test the IPMI interface is reachable using the default port 623:
nmap -sU -p623 192.168.3.99 |
Finally you can safely test your configuration by printing the chassis status on each node remotely.
ipmitool -I lanplus -H 192.168.3.99 -U Administrator -P 60142058 -v chassis status |
Set up a password script instead of directly using password.
cat > /usr/local/bin/IPMI_password_node1 << EOF |
In a 2-node cluster it may happen that both nodes are unable to contact each other and then each node tries to fence the other one. But can't reboot both nodes at the same time since that will result in downtime and possibly harm cluster integrity. To avoid this need to configure a different delay (e.g., one without delay, and the other one with at least a 10 second delay).
pcs stonith create node1_ilo fence_ilo4 ipaddr="192.168.3.99" \ |
Unwanted fencing might happen also when a node "commit suicide", i.e., shut itself down because it was not able to contact the other node of the cluster. This is an unwanted situation because all nodes of a cluster might be fenced at the same time. To avoid this should set a constraint to prevent a node's stonith resource from running on the cluster node itself:
pcs constraint location fence_node1 avoids node1-hb |
To prevent unwanted fencing in the event of minor network outages, increase the totem token timeout to at least 5 seconds by editing /etc/corosync/corosync.conf as follows:
totem { |
Then sync this config file to all other cluster nodes and reload corosync:
pcs cluster sync |
Now that fencing is configured, set the stonith property to true to enable it:
pcs property set stonith-enabled=true |
Once the fence device has been configured in the cluster with the same options that worked manually and the cluster has been started, test fencing with the pcs stonith fence command from any node (or even multiple times from different nodes), as in the following example. The pcs stonith fence command reads the cluster configuration from the CIB and calls the fence agent as configured to execute the fence action. This verifies that the cluster configuration is correct.
pcs stonith fence node1-hb |
Configuring Resources
Monitor the link status of a network interface bond0
pcs resource create bond0-monitor ethmonitor interface=bond0 --clone |
Create oracle database resources
・ Oracle Database in Pacemaker
Configuring constraints to prevent resources failling back
pcs constraint show --full |



