| title | Deploy a Pacemaker Cluster for SQL Server on Linux | |||
|---|---|---|---|---|
| description | Learn to deploy a Linux Pacemaker cluster for a SQL Server Always On availability group (AG) or failover cluster instance (FCI). | |||
| author | rwestMSFT | |||
| ms.author | randolphwest | |||
| ms.reviewer | atsingh | |||
| ms.date | 01/15/2026 | |||
| ms.service | sql | |||
| ms.subservice | linux | |||
| ms.topic | install-set-up-deploy | |||
| ms.custom |
|
[!INCLUDE SQL Server - Linux]
This tutorial describes the tasks required to deploy a Linux Pacemaker cluster for a [!INCLUDE ssnoversion-md] Always On availability group (AG) or failover cluster instance (FCI). Unlike the tightly coupled Windows Server / [!INCLUDE ssnoversion-md] stack, you can create a Pacemaker cluster and configure an availability group (AG) on Linux before or after installing [!INCLUDE ssnoversion-md]. You configure the integration and resources for the Pacemaker portion of an AG or FCI deployment after the cluster is configured.
Important
An AG with a cluster type of None doesn't require a Pacemaker cluster and can't be managed by Pacemaker.
[!div class="checklist"]
- Install the high availability add-on and install Pacemaker.
- Prepare the nodes for Pacemaker (RHEL and Ubuntu only).
- Create the Pacemaker cluster.
- Install the SQL Server HA and SQL Server Agent packages.
Note
Starting in [!INCLUDE sssql25-md], SUSE Linux Enterprise Server (SLES) isn't supported.
Use the following syntax to install the packages that make up the high availability (HA) add-on for each distribution of Linux.
-
Register the server using the following syntax. You're prompted for a valid username and password.
sudo subscription-manager register
-
List the available pools for registration.
sudo subscription-manager list --available
For RHEL 10, use the following command:
sudo subscription-manager repos --list
From the list of available pools, note the pool ID for the high availability subscription.
-
Run the following command to associate RHEL high availability with the subscription. In this example,
<PoolId>is the pool ID for the high availability subscription from the previous step.sudo subscription-manager attach --pool=<PoolID>
-
Enable the repository to use the high availability add-on.
RHEL 7
sudo subscription-manager repos --enable=rhel-ha-for-rhel-7-server-rpms
RHEL 8
sudo subscription-manager repos --enable=rhel-8-for-x86_64-highavailability-rpms
RHEL 9
sudo subscription-manager repos --enable=rhel-9-for-x86_64-highavailability-rpms
RHEL 10
sudo subscription-manager repos --enable=rhel-10-for-x86_64-highavailability-rpms
-
Install Pacemaker.
sudo yum install pacemaker pcs fence-agents-all resource-agents
Install the High Availability pattern in YaST, or install it as part of the main installation of the server. You can use an ISO or DVD as a source, or get it online.
Note
On SLES, the HA add-on is initialized when you create the cluster.
Ubuntu 20.04
sudo apt-get install pacemaker pcs fence-agents resource-agentsUbuntu 22.04 and later versions
sudo apt-get install pacemaker pcs fence-agents resource-agents-base resource-agents-common resource-agents-extraPacemaker uses a user named hacluster that you create on the distribution. On RHEL and Ubuntu, the HA add-on installation creates this user.
-
On each server that will serve as a node in the Pacemaker cluster, create the password for a user that the cluster uses. The examples use the name
hacluster, but you can use any name. All nodes in the Pacemaker cluster must use the same name and password.sudo passwd hacluster
-
On each node that will be part of the Pacemaker cluster, enable and start the
pcsdservice with the following commands (RHEL and Ubuntu).sudo systemctl enable pcsd sudo systemctl start pcsdThen, run the following command to make sure that
pcsdstarts.sudo systemctl status pcsd
-
Enable the Pacemaker service on each possible node in the Pacemaker cluster.
sudo systemctl start pacemaker
On Ubuntu, you see the following error.
pacemaker Default-Start contains no runlevels, aborting.This error is a known issue. Despite the error, enabling the Pacemaker service is successful. This bug will be fixed in a future update.
-
Next, create and start the Pacemaker cluster. There's one difference between RHEL and Ubuntu at this step. While on both distributions, installing
pcsconfigures a default configuration file for the Pacemaker cluster, on RHEL, running this command removes any existing configuration and creates a new cluster.
This section describes how to create and configure the cluster for each Linux distribution.
-
Authorize the nodes. In these examples,
<NodeX>is the name of each node.RHEL 7
Replace
<password>with the password forhacluster.sudo pcs cluster auth <Node1 Node2 ... NodeN> -u hacluster -p <password>
RHEL 8 and later versions
Manually enter the username and password for
haclusterwhen prompted.sudo pcs host auth <Node1> <Node2> <Node3>
-
Create the cluster. In this example,
PMClusterNameis the name you assign to the Pacemaker cluster.RHEL 7
sudo pcs cluster setup --name <PMClusterName> <Node1> <Node2> <Node3>
RHEL 8 and later versions
sudo pcs cluster setup <PMClusterName> <Node1> <Node2> <Node3>
-
Start the cluster on all nodes.
sudo pcs cluster start --all
-
Enable the cluster to start when the computer starts.
sudo pcs cluster enable --all -
Verify the cluster status.
sudo pcs status
The process for creating a Pacemaker cluster is different on SLES than it is on RHEL and Ubuntu. The following steps show how to create a cluster with SLES.
-
Start the cluster configuration process by running the following command on one of the nodes:
sudo ha-cluster-init
You might be prompted that NTP isn't configured and that no watchdog device is found. This condition is fine for getting the cluster up and running. Watchdog is related to fencing a failed node. If you use SLES's built-in fencing, that fencing is storage-based. You can configure NTP and watchdog later.
-
You're prompted to configure Corosync. You're prompted for the network address to bind to, as well as the multicast address and port. The network address is the subnet that you're using (for example,
192.191.190.0). You can accept the defaults at every prompt, or change if necessary. -
Next, you're prompted to configure SBD, which is the disk-based fencing. You can choose to configure this setting later. If you don't configure SBD, unlike on RHEL and Ubuntu, the process sets
stonith-enabledtofalseby default. -
Finally, you're prompted to configure an IP address for administration. This IP address is optional, but functions similar to the IP address for a Windows Server failover cluster (WSFC). It creates an IP address in the cluster to be used for connecting to it via HA Web Konsole (HAWK). This configuration is also optional.
-
Ensure that the cluster is up and running.
sudo crm status
-
Change the
haclusterpassword.sudo passwd hacluster
-
If you configured an IP address for administration, you can test it in a browser. This test also checks the password change for
hacluster.:::image type="content" source="media/sql-server-linux-deploy-pacemaker-cluster/image2.png" alt-text="Screenshot of hacluster.":::
-
On another SLES server that will act as a node of the cluster, run the following command:
sudo ha-cluster-join
-
When prompted, enter the name or IP address of the server that you configured as the first node of the cluster in the previous steps. The server is added as a node to the existing cluster.
-
Verify the node was added.
sudo crm status
-
Change the
haclusterpassword.sudo passwd hacluster
-
Repeat Steps 8-11 for all other servers to add to the cluster.
Configuring Ubuntu is similar to RHEL. However, there's one major difference: installing the Pacemaker packages creates a base configuration for the cluster, and enables and starts pcsd. If you try to configure the Pacemaker cluster by following the RHEL instructions exactly, you get an error. To fix this problem, perform the following steps.
-
Remove the default Pacemaker configuration from each node.
sudo pcs cluster destroy
-
Create the cluster. In this example,
PMClusterNameis the name you assign to the Pacemaker cluster, andNodelistis the list of node names separated by a space.Ubuntu 20.04
sudo pcs cluster setup --name <PMClusterName Nodelist> --start --all --enable
Ubuntu 22.04 and later versions
-
Authorize the nodes. In this example,
NodeXis the name of the node.sudo pcs host auth <Node1 Node2 ... NodeN> -u hacluster
-
Create the cluster. In this example,
PMClusterNameis the name you assign to the Pacemaker cluster, andNodelistis the list of node names separated by a space.sudo pcs cluster setup <PMClusterName Nodelist>
-
Enable the cluster to start when the computer starts.
sudo pcs cluster enable --all -
Verify the cluster status.
sudo pcs status
Use the following commands to install the SQL Server HA package and [!INCLUDE ssnoversion-md] Agent, if they aren't installed already. If you install the HA package after installing [!INCLUDE ssnoversion-md], you must restart [!INCLUDE ssnoversion-md] for the change to take effect. These instructions assume that the repositories for the Microsoft packages are already set up, since [!INCLUDE ssnoversion-md] should be installed at this point.
-
If you don't use [!INCLUDE ssnoversion-md] Agent for log shipping or any other use, you don't need to start or configure it.
-
The other optional packages for [!INCLUDE ssnoversion-md] on Linux, [!INCLUDE ssnoversion-md] Full-Text Search (mssql-server-fts) and [!INCLUDE ssnoversion-md] Integration Services (mssql-server-is), aren't required for high availability, either for an FCI or an AG.
sudo yum install mssql-server-ha
sudo systemctl restart mssql-serversudo zypper install mssql-server-ha
sudo systemctl restart mssql-serversudo apt-get install mssql-server-ha
sudo systemctl restart mssql-serverIn this tutorial, you learned how to deploy a Pacemaker cluster for SQL Server on Linux. You learned how to:
[!div class="checklist"]
- Install the high availability add-on and install Pacemaker.
- Prepare the nodes for Pacemaker (RHEL and Ubuntu only).
- Create the Pacemaker cluster.
- Install the SQL Server HA and SQL Server Agent packages.
To create and configure an availability group for SQL Server on Linux, see:
[!div class="nextstepaction"] Create and configure an availability group for SQL Server on Linux.