Muokkaa

Jaa


Deploy a Pacemaker cluster for SQL Server on Linux

Applies to: SQL Server on Linux

This tutorial describes the tasks required to deploy a Linux Pacemaker cluster for a SQL Server Always On availability group (AG) or failover cluster instance (FCI). Unlike the tightly coupled Windows Server / SQL Server stack, you can create a Pacemaker cluster and configure an availability group (AG) on Linux before or after installing SQL Server. 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.

  • 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 SQL Server 2025 (17.x), SUSE Linux Enterprise Server (SLES) isn't supported.

Prerequisites

Install SQL Server on Linux.

Install the high availability add-on

Use the following syntax to install the packages that make up the high availability (HA) add-on for each distribution of Linux.

  1. Register the server using the following syntax. You're prompted for a valid username and password.

    sudo subscription-manager register
    
  2. List the available pools for registration.

    sudo subscription-manager list --available
    
  3. Run the following command to associate RHEL high availability with the subscription.

    sudo subscription-manager attach --pool=<PoolID>
    

    In this example, PoolId is the pool ID for the high availability subscription from the previous step.

  4. Enable the repository to use the high availability add-on.

    sudo subscription-manager repos --enable=rhel-ha-for-rhel-7-server-rpms
    
  5. Install Pacemaker.

    sudo yum install pacemaker pcs fence-agents-all resource-agents
    

Prepare the nodes for Pacemaker (RHEL and Ubuntu only)

Pacemaker uses a user named hacluster that you create on the distribution. On RHEL and Ubuntu, the HA add-on installation creates this user.

  1. 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
    
  2. On each node that will be part of the Pacemaker cluster, enable and start the pcsd service with the following commands (RHEL and Ubuntu):

    sudo systemctl enable pcsd
    sudo systemctl start pcsd
    

    Then, run the following command to make sure that pcsd starts.

    sudo systemctl status pcsd
    
  3. Enable the Pacemaker service on each possible node in the Pacemaker cluster.

    sudo systemctl start pacemaker
    

    On Ubuntu, you see an 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.

  4. Next, create and start the Pacemaker cluster. There's one difference between RHEL and Ubuntu at this step. While on both distributions, installing pcs configures a default configuration file for the Pacemaker cluster, on RHEL, running this command removes any existing configuration and creates a new cluster.

Create the Pacemaker cluster

This section describes how to create and configure the cluster for each Linux distribution.

  1. Authorize the nodes:

    sudo pcs cluster auth <Node1 Node2 ... NodeN> -u hacluster
    

    In this example, NodeX is the name of the node.

  2. Create the cluster:

    sudo pcs cluster setup --name <PMClusterName Nodelist> --start --all --enable
    

    In this example, PMClusterName is the name you assign to the Pacemaker cluster, and Nodelist is the list of node names separated by a space.

Install the SQL Server HA and SQL Server Agent packages

Use the following commands to install the SQL Server HA package and SQL Server Agent, if they aren't installed already. If you install the HA package after installing SQL Server, you must restart SQL Server for the change to take effect. These instructions assume that the repositories for the Microsoft packages are already set up, since SQL Server should be installed at this point.

  • If you don't use SQL Server Agent for log shipping or any other use, you don't need to start or configure it.

  • The other optional packages for SQL Server on Linux, SQL Server Full-Text Search (mssql-server-fts) and SQL Server Integration Services (mssql-server-is), aren't required for high availability, either for an FCI or an AG.

sudo yum install mssql-server-ha mssql-server-agent
sudo systemctl restart mssql-server

Next step

In this tutorial, you learned how to deploy a Pacemaker cluster for SQL Server on Linux. You learned how to:

  • 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: