With Oracle Linux instances running on Oracle Cloud Infrastructure (OCI), you can create high availability (HA) clusters that deliver continuous access to applications and services running across multiple nodes. HA clustering minimizes downtime and provides continuous service if and when system components fail.
Before you begin, configure a shared storage device to be accessible from all nodes that you want in the HA cluster. A shared storage device is needed for cluster service and application messaging, and for cluster SBD fencing. For more information about setting up a shared storage device, see Oracle Linux 9 Managing Shared File Systems and Oracle Linux 8 Managing Shared File Systems.
Setting Up High Availability Clustering With OCI Instances
To set up high availability clustering with OCI instances:
To create a high availability (HA) cluster with Oracle Cloud Infrastructure (OCI) instances, you must first install the Pacemaker and Corosync packages on each instance, or node, that you want in the cluster. You can then configure each cluster node, and ensure that the Pacemaker service automatically starts and runs on each node at boot time.
Note
OCI instance, node, and cluster node are used interchangeably with HA clustering for OCI.
Best Practice
For each OCI instance that you want in the cluster, open a terminal window and connect to the instance.
For example, if you want two OCI instances to be nodes in the cluster, open two terminal windows, and connect to each instance using ssh:
ssh instance-IP-address
Having a terminal window open for each node prevents the need to repeatedly log in and out of the nodes when configuring the HA cluster.
Installing Pacemaker and Corosync
To install the Pacemaker and Corosync packages and configure the HA cluster nodes:
With the Pacemaker and Corosync software, you can create a high availability (HA) cluster with Linux instances running on Oracle Cloud Infrastructure (OCI).
To create an HA cluster:
Install the Pacemaker and Corosync software packages on each node you want in the cluster. See Installing Pacemaker.
From one of the nodes, authenticate the pcs cluster configuration tool for the hacluster user of each cluster node.
For example, if you want two nodes to make up the HA cluster, run the following command from one of the cluster nodes:
From one of the nodes, start the cluster on all nodes:
Copy
sudo pcs cluster start --all
Configure SBD fencing for the newly created HA cluster. See Configuring Fencing.
Configuring Fencing 🔗
STONITH Block Device (SBD) fencing works with the Pacemaker software to protect data when a node in a high availability (HA) cluster becomes unresponsive. Fencing prevents the live nodes in the HA cluster from accessing data on the unresponsive node until the Pacemaker software takes that unresponsive node offline.
SBD fencing configuration is the last step in completing the setup of an HA cluster with OCI instances. For information about creating an HA cluster, see Creating an HA Cluster.
Note
To create HA clusters with OCI instances, you must use only the SBD cluster fencing mechanism. Other cluster fencing mechanisms aren't currently supported in this environment.
Configuring SBD Fencing for an HA Cluster
To configure SBD fencing for an HA cluster:
From one of the cluster nodes, enable stonith (Shoot The Other Node In The Head), a fencing technique that's used as part of the SBD fencing strategy.
Copy
sudo pcs property set stonith-enabled=true
From one of the nodes, stop the cluster:
Copy
sudo pcs cluster stop --all
On each node, install and configure the SBD daemon:
Copy
sudo dnf install sbd
On each node, enable the sbd systemd service:
Copy
sudo systemctl enable sbd
Note
When enabled, the sbd systemd service automatically starts and stops as a dependency of the Pacemaker service. This means you don't need to run the sbd service independently, and you can't manually start or stop the service. If you try to manually start or stop it, the state of the service remains the same, and an error message is displayed, indicating that the service is a dependent service.