• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install and Configure Pacemaker on Rocky Linux

in Rocky Linux
How to Install and Configure Pacemaker on Rocky Linux

Pacemaker is an open-source, high-availability resource manager that ensures the reliability and availability of your critical services in a Linux cluster environment. This blog post will guide you through the process of how to install and configure Pacemaker on Rocky Linux, a popular Linux distribution ideal for server environments.

Prerequisites

Before we begin, make sure you have the following:

  1. A system running Rocky Linux
  2. Root or sudo access

How to Install and Configure Pacemaker on Rocky Linux

Update System Packages

First, update your system packages to the latest versions:

sudo dnf update -y

Enable the necessary repositories: If the packages are not available in the default repositories, you might need to enable the necessary repositories for Rocky Linux. Run the following commands:

sudo dnf install -y epel-release
sudo dnf config-manager --set-enabled powertools

Installing Pacemaker on Rocky Linux

Install the Pacemaker, Corosync, and pcs packages:

sudo dnf install -y pacemaker pcs corosync

Enable and Start Services on Rocky Linux

Enable and start the Corosync and Pacemaker services:

sudo systemctl enable --now corosync
sudo systemctl enable --now pacemaker

Configure Firewall Rules

Add the necessary firewall rules to allow cluster communication:

sudo firewall-cmd --permanent --add-service=high-availability
sudo firewall-cmd --reload

Set Up Cluster Authentication on Rocky Linux

Set up cluster authentication by creating a password for the hacluster user:

sudo passwd hacluster

Configure Corosync on Rocky Linux

To configure Corosync, first create a cluster configuration file:

sudo nano /etc/corosync/corosync.conf

Add the following contents, replacing the {node_name} and {node_ip} placeholders with your node’s hostname and IP address:

totem {
  version: 2
  cluster_name: my_cluster
  transport: udpu
}

nodelist {
  node {
    ring0_addr: {node_ip}
    nodeid: 1
    name: {node_name}
  }
}

quorum {
  provider: corosync_votequorum
  two_node: 1
}

logging {
  to_logfile: yes
  logfile: /var/log/corosync/corosync.log
  to_syslog: yes
}

Create and Configure Cluster on Rocky Linux

To create a cluster, run the following command:

sudo pcs cluster setup my_cluster {node_name} --start --enable --token 3000

Synchronize the Corosync configuration across the cluster:

sudo pcs cluster sync

Configure Cluster Resources on Rocky Linux

Now you can start configuring cluster resources. For example, to create an Apache web server resource, follow these steps:

  1. Install the Apache web server:
sudo dnf install -y httpd
  1. Create an Apache resource:
sudo pcs resource create Apache ocf:heartbeat:apache configfile=/etc/httpd/conf/httpd.conf op monitor interval=30s

For more advanced resource configuration, check out the official Pacemaker documentation.

Configure Resource Constraints

To set up resource constraints, such as colocation or ordering, use the pcs command:

sudo pcs constraint colocation add {resource1} with {resource2} [score]
sudo pcs constraint order {resource1} then {resource2}

Replace {resource1} and {resource2} with your resource names, and [score] with a numerical value representing the preference for the colocation.

Replace {resource1} and {resource2} with your resource names, and [score] with a numerical value representing the preference for the colocation.

Configure Resource Stickiness

Resource stickiness ensures that a resource stays on the same node unless it fails. This can be helpful in minimizing the number of failovers and preventing unnecessary movement of resources. To configure resource stickiness, use the following command:

pcs resource defaults resource-stickiness=[stickiness_value]

Replace [stickiness_value] with the desired numerical value for stickiness. A higher value indicates stronger preference for the resource to stay on the current node.

Configure Failure Timeout

Failure timeout specifies the time after which a failed resource will be attempted to start again. To configure the failure timeout for a resource, use the following command:

pcs resource op defaults timeout=[timeout_value]

Replace [timeout_value] with the desired timeout value in seconds.

Verify the Cluster Configuration on Rocky Linux

After you have configured your Pacemaker cluster, it’s essential to verify the configuration. You can do this by running the following command:

pcs status

This command will display the current status of your cluster, including the resources and their states. Ensure that everything is running as expected.

Test the Cluster

Finally, to test the cluster, you can simulate a failure on one of the nodes. To do this, run the following command on the primary node:

pcs cluster standby [node_name]

Replace [node_name] with the name of the node you want to put in standby mode. After running this command, you should see the resources migrate to the other node. You can then bring the node back online using the command:

pcs cluster unstandby [node_name]

This will bring the node back online, and depending on your configuration, the resources may migrate back to the primary node.

Conclusion

In this blog post, we have covered the installation and configuration of Pacemaker on Rocky Linux. You now have a solid understanding of the steps required to set up a high-availability cluster using Pacemaker. By following these steps, you can ensure that your critical services remain online even in the event of a failure.

For more information and tutorials on Rocky Linux, be sure to check out the following resources:

  1. How to Install and Configure GlusterFS on Rocky Linux
  2. How to Install Flask on Rocky Linux
  3. How to Install Django on Rocky Linux
  4. How to Install Apache Tomcat on Rocky Linux
  5. How to Set Up NTP Server on Rocky Linux
ShareTweet
Previous Post

How to Install and Configure Ceph on Rocky Linux

Next Post

How to Install and Configure Puppet on Rocky Linux

Related Posts

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

Set up FreeIPA on Rocky Linux

How to Install and Configure FreeIPA on Rocky Linux

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.