High Availability Storage with Pacemaker

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Introduction

High Availability Storage with Pacemaker is a solution for ensuring that critical data and applications remain available and accessible even in the event of hardware failures or other disruptions. A pacemaker is a cluster resource manager that allows you to configure and manage clusters of computers that work together to provide high availability for your applications and data.

The High Availability Storage with Pacemaker solution typically involves a cluster of multiple nodes, each of which has access to a shared storage device. This shared storage device is used to store critical data and applications, which can be accessed by any node in the cluster. In the event of a node failure, the Pacemaker cluster will automatically fail over to another node in the cluster, ensuring that the data and applications remain available.

A step-by-step guide to configuring high-availability storage with Pacemaker on CentOS:

Ensure all nodes in the cluster have access to the shared storage device(s). This can be done by connecting the storage device(s) to a storage network that all nodes have access.

Install Pacemaker on all nodes in the cluster using the following command:

sudo dnf install pacemaker pcs fence-agents-all

This command will install the Pacemaker cluster software, the pcs command-line tool, and a collection of fencing agents.

Configure the firewall to allow access to the Pacemaker cluster on all nodes using the following commands:

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

Create a Pacemaker cluster by running the following command on one of the nodes:

sudo pcs cluster setup --name mycluster node1 node2 node3

This command will configure the Pacemaker configuration files and generate a cluster configuration file that can be used to create the cluster on all nodes. Replace “mycluster” with the desired name for your cluster, and replace “node1”, “node2”, and “node3” with the hostnames or IP addresses of the nodes in your cluster.

Start the Pacemaker cluster on all nodes using the following command:

sudo pcs cluster start --all

This command will start the Pacemaker cluster on all nodes in the cluster.

Add the shared storage device(s) to the cluster by running the following command:

sudo pcs cluster cib stonith_cfg

This command will open the Pacemaker configuration file in a text editor. Add the following XML snippet to define the shared storage device(s) as the storage device(s) to be used for the cluster’s fencing mechanism:

<configuration>
   <fencing>
      <method name="sbd">
         <device class="stonith" name="sbd">
            <instance_attributes stonith-timeout="60"/>
         </device>
      </method>
   </fencing>
</configuration>

Save and close the file.

Enable the sbd (Stonith Block Device) service on all nodes using the following command:

sudo systemctl enable sbd

Configure the Pacemaker cluster to use the shared storage device(s) for high availability storage by running the following command:

sudo pcs resource create shared_storage ocf:heartbeat:Filesystem device="/dev/sdb1" \ directory="/mnt/shared_storage" fstype="xfs" options="nofail" op monitor interval="30s" \
on-fail="standby" clone

This command will create a “Pacemaker resource agent” that monitors the shared storage device(s) and automatically fails over to another node in the cluster if a problem is detected. Replace “/dev/sdb1” with the path to your shared storage device, and “/mnt/shared_storage” with the desired mount point for your shared storage.

Verify that the shared storage device(s) are available on all nodes in the cluster by running the following command:

sudo pcs status resources

This command will display the status of all resources in the Pacemaker cluster, including the shared_storage resource.

Test the high-availability storage configuration by simulating a node failure using the following command:

sudo pcs cluster simulate node1

This command will simulate a failure of the “node1” node in the cluster,

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Neil
Neil
Treat your password like your toothbrush. Don’t let anybody else use it, and get a new one every six months.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook