Configure SAP S/4HANA ASCS/ERS with Standalone Enqueue Server 2 (ENSA2) in Pacemaker on RHEL 7.6

Updated -

Table of Contents

Note this article is currently a preview that is subject to changes. For feedback on this article please use the comments below the article

1. Overview

1.1. Introduction

SAP S/4HANA systems play an important role in business processes, thus it's critical for such systems to be highly available. The underlying idea of Clustering is a fairly simple one: Not a single large machine bears all of the load and risk; but rather one or more machines automatically drop in as an instant full replacement for the service or the machine that has failed. In the best case, this replacement process causes no interruption to the systems' users.

1.2. Audience

This document is intended for SAP and Red Hat certified or trained administrators and consultants who already have experience setting up high available solutions using the RHEL HA add-on or other clustering solutions. Access to both SAP Service Marketplace and Red Hat Customer Portal is required to be able to download software and additional documentation.

Red Hat Consulting is highly recommend to set up the cluster and customize the solution to meet customers' data center requirements, that are normally more complex than the solution presented in this document.

1.3. Concepts

This document describes how to set up a two-node or three-node cluster solution that conforms to the guidelines for high availability that have been established by both SAP and Red Hat. It is based on Standalone Enqueue Server 2, now the default installation in SAP S/4HANA 1809 or newer, on top of Red Hat Enterprise Linux 7.6 or newer with RHEL HA Add-on.

According to SAP, the Standalone Enqueue Server 2 (ENSA2) is the successor to the standalone enqueue server. It is a component of the SAP lock concept and manages the lock table. This principle ensures the consistency of data in an ABAP system. If there is a failover, the old Standalone Enqueue Server was required to "follow" the Enqueue Replication Server. That is, the HA software had to start the ASCS instance on the host where the ERS instance is currently running. In contrast to the old Standalone Enqueue Server, the new Standalone Enqueue Server 2 and Enqueue Replicator 2 no longer have these restrictions. For more info. on ENSA2 please refer to SAP Note 2630416 - Support for Standalone Enqueue Server 2

1.4. Support Policies

See: Support Policies for RHEL High Availability Clusters - Management of SAP S/4HANA

2. Requirements

2.1 Subscription

It’s important to keep the subscription, kernel, and patch level identical on all cluster nodes.

Please follow this kbase article to subscribe your systems to the Update Service for RHEL for SAP Solutions.

2.2. Pacemaker Resource Agents

  • RHEL for SAP Solutions 7.6 or newer
  • On RHEL versions 7.5 or older, install resource-agents-sap-4.1.1-12.el7.x86_64 or newer

2.3. SAP S/4HANA High-Availability Architecture

A typical setup for SAP S/4HANA High-Availability consists of 3 distinctive components:

This article focuses on the configuration of SAP S/4 ASCS and ERS in a pacemaker cluster. As the best practice, we recommend to install Application Servers and Database on separate nodes outside of the cluster designated for (A)SCS and ERS.

2.4. Two node cluster vs. multi node cluster

If there is a failover, the old Standalone Enqueue Server was required to "follow" the Enqueue Replication Server. That is, the HA software had to start the ASCS instance on the host where the ERS instance is currently running. In contrast to the old Standalone Enqueue Server, the new Standalone Enqueue Server 2 and Enqueue Replicator 2 no longer have these restrictions, that makes a multi-node cluster possible.

The ENSA2 in pacemaker can be configured in either a two-node or a multi-node cluster. In a two-node cluster, ASCS will failover to where ERS is running, while in a multi-node cluster, ASCS will failover to a spare node as illustrated below.

EFS Creation

Note: Below is the architecture diagram of the example installation of a three-node cluster. The example in this article focuses on a two-node cluster setup, with a separate section on the design and configuration of a multi node cluster.

EFS Creation

2.5. `SAPInstance` resource agent

SAPInstance is a pacemaker resource agent used for both ASCS and ERS resources. All operations of the SAPInstance resource agent are done by using the SAP start service framework sapstartsrv.

2.6. Storage requirements

Directories created for S/4 installation should be put on shared storage, following the rules:

2.6.1. Instance Specific Directory

The instance specific directory for 'ASCS' and 'ERS', respectively, must be present on the corresponding node. These directories must be available before the cluster is started.

  • ASCS node: /usr/sap/SID/ASCS<Ins#>
  • ERS node: /usr/sap/SID/ERS<Ins#>

For Application Servers, the following directory should be made available on corresponding node designated for the Application Server instance:

  • App Server D<Ins#>: /usr/sap/SID/D<Ins#>

2.6.2. Shared Directories

The following mount points must be available on ASCS, ERS, and Application Servers nodes.

/sapmnt
/usr/sap/trans
/usr/sap/SID/SYS

2.6.3. Shared Directories on HANA

The following mount point(s) must be available on the HANA node.

/sapmnt

Shared storage can be achieved by:

These mount points must be either managed by cluster or mounted before cluster is started.

3. Install SAP S/4

3.1. Configuration options used in this document

Below are configuration options that will be used for instances in this document:

Two nodes will be running the ASCS/ERS instances in pacemaker:

1st node hostname:      s4node1
2nd node hostname:      s4node2

SID:                    S4H

ASCS Instance number:   20
ASCS virtual hostname:  s4ascs

ERS Instance number:    29
ERS virtual hostname:   s4ers

Outside the two-node cluster:

PAS Instance number:    21
AAS Instance number:    22

HANA database:

SID:                    S4D
HANA Instance number:   00
HANA virtual hostname:  s4db

3.2. Prepare hosts

Before starting installation ensure that:

  • Install RHEL for SAP Solutions 7.x (latest is recommended)
  • Register system to RHN or Satellite, enable RHEL for SAP Applications channel, or Update Services (E4S) channel
  • Enable High Availability Add-on channel
  • Shared storage and filesystems are present at correct mount points
  • Virtual IP addresses used by instances are present and reachable
  • Hostnames that will be used by instances can be resolved to IP addresses and back
  • Installation medias are available
  • System is configured according to the recommendation for running SAP S/4

3.3. Install S/4

Using software provisioning manager (SWPM) install instances in the following order:

  • ASCS instance
  • ERS instance
  • DB instance
  • PAS instance
  • AAS instances

3.3.1. Install S/4 on s4node1

The following file systems should be mounted on s4node1, where ASCS will be installed:

/usr/sap/S4H/ASCS20
/usr/sap/S4H/SYS
/usr/sap/trans
/sapmnt

Virtual IP for s4ascs should be enabled on s4node1.

Run the installer:

[root@s4node1]# ./sapinst SAPINST_USE_HOSTNAME=s4ascs

Select High-Availability System option.

ASCS Installation

3.3.2. Install ERS on s4node2

The following file systems should be mounted on s4node2, where ERS will be installed:

/usr/sap/S4H/ERS29
/usr/sap/S4H/SYS
/usr/sap/trans
/sapmnt

Virtual IP for s4ers should be enabled on s4node2.

Run the installer:

[root@s4node2]# ./sapinst SAPINST_USE_HOSTNAME=s4ers

Select High-Availability System option.

ERS Installation

3.3.3. SAP HANA

In the example, SAP HANA will be using the following configuration. You can also use other supported database.

SAP HANA SID:                    S4D
SAP HANA Instance number:        00

SAP HANA should be installed on a separate host. Optionally, Automated HANA System Replication can be installed in another pacemaker cluster by following document SAP HANA system replication in pacemaker cluster.

Run the installer on the HANA host:

[root]# ./sapinst SAPINST_USE_HOSTNAME=s4db

3.3.4. Install Application Servers

The following file systems should be mounted on the host to run the Application Server instance. If you have multiple application servers, install each one on corresponding host:

/usr/sap/S4H/D<Ins#>
/usr/sap/S4H/SYS
/usr/sap/trans
/sapmnt

Run the installer:

[root]# ./sapinst

Select High-Availability System option.

3.4. Post Installation

3.4.1. (A)SCS profile modification

(A)SCS instance requires following modification in profile to prevent automatic restart of enqueue server as it will be managed by cluster. To apply the change run the following command at your ASCS profile /sapmnt/S4H/profile/S4H_ASCS20_s4ascs.

[root]# sed -i -e 's/Restart_Program_01/Start_Program_01/' /sapmnt/S4H/profile/S4H_ASCS20_s4ascs

3.4.2. ERS profile modification

ERS instance requires following modification in profile to prevent automatic restart as it will be managed by cluster. To apply the change run the following command at your ERS profile /sapmnt/S4H/profile/S4H_ERS29_s4ers.

[root]# sed -i -e 's/Restart_Program_00/Start_Program_00/' /sapmnt/S4H/profile/S4H_ERS29_s4ers

3.4.3. Update the `/usr/sap/sapservices` file

On both s4node1 and s4node2, make sure following two lines are commented out in /usr/sap/sapservices file:

#LD_LIBRARY_PATH=/usr/sap/S4H/ERS29/exe:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; /usr/sap/S4H/ERS29/exe/sapstartsrv pf=/usr/sap/S4H/SYS/profile/S4H_ERS29_s4ers -D -u s4hadm
#LD_LIBRARY_PATH=/usr/sap/S4H/ASCS20/exe:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; /usr/sap/S4H/ASCS20/exe/sapstartsrv pf=/usr/sap/S4H/SYS/profile/S4H_ASCS20_s4ascs -D -u s4hadm

3.4.4. Create mount points for ASCS and ERS on the failover node, respectively:

[root@s4node1 ~]# mkdir /usr/sap/S4H/ERS29/
[root@s4node1 ~]# chown s4hadm:sapsys /usr/sap/S4H/ERS29/

[root@s4node2 ~]# mkdir /usr/sap/S4H/ASCS20
[root@s4node2 ~]# chown s4hadm:sapsys /usr/sap/S4H/ASCS20

3.4.5. Manual Testing Instance on Other Node

Stop ASCS and ERS instances. Move the instance specific directory to the other node:

[root@s4node1 ~]# umount /usr/sap/S4H/ASCS20
[root@s4node2 ~]# mount /usr/sap/S4H/ASCS20

[root@s4node2 ~]# umount /usr/sap/S4H/ERS29/
[root@s4node1 ~]# mount /usr/sap/S4H/ERS29/

Manually start ASCS and ERS instances on other cluster node, then manually stop them, respectively.

3.4.6. Check SAP HostAgent on all nodes

On all nodes check if SAP HostAgent has the same version and meets the minimum version requirement:

[root]# /usr/sap/hostctrl/exe/saphostexec -version

To upgrade/install SAP HostAgent, follow SAP note 1031096.

3.4.7. Install permanent SAP license keys

SAP hardware key determination in the high-availability scenario has been improved. It might be necessary to install several SAP license keys based on the hardware key of each cluster node. Please see SAP Note 1178686 - Linux: Alternative method to generate a SAP hardware key for more information.

4. Install Pacemaker

Follow Pacemaker documentation: HA Add-On Reference - RHEL 7.

Below is a sample procedure to install pacemaker. It's recommended to work with a Red Hat consultant to install and configure Pacemaker in your environment.

4.1. Install Pacemaker rpm's

# yum -y install pcs pacemaker
# passwd hacluster
[provide a password]
# systemctl enable pcsd.service; systemctl start pcsd.service

4.2. Create a Cluster

Create a cluster named s4ha, consisting of s4node1 and s4node2, and start the cluster. Please note that at this point, cluster is not yet configured to auto-start after reboot.

# pcs cluster auth s4node1 s4node2
# pcs cluster setup --name s4ha s4node1 s4node2
# pcs cluster start --all

4.3. Configure STONITH

The fencing mechanism STONITH depends on the underneath platform. Please check the corresponding document to configure the STONITH. Support Policies for RHEL High Availability Clusters - General Requirements for Fencing/STONITH.

After configuring the STONITH, on s4node1 test fencing s4node2.

[root@s4node1]# pcs stonith fence s4node2

s4node2 should be properly fenced. After fencing, start cluster on s4node2 using the following command. This is because the cluster has not yet been enabled to auto-start. Auto-start will be enabled after initial testings showing the cluster is properly configured.

[root@s4node2 ~]# pcs cluster start

4.4. Install `resource-agents-sap` on all cluster nodes

[root]# yum install resource-agents-sap

4.5. Configure cluster resources for shared filesystems

Configure shared filesystem to provide following mount points on all of cluster nodes.

/sapmnt
/usr/sap/trans
/usr/sap/S4H/SYS

4.5.1. Configure shared filesystems managed by the cluster

The cloned Filesystem cluster resource can be used to mount the shares from external NFS server on all cluster nodes as shown below.

[root]# pcs resource create s4h_fs_sapmnt Filesystem device='<NFS_Server>:<sapmnt_nfs_share>' directory='/sapmnt' fstype='nfs' --clone interleave=true
[root]# pcs resource create s4h_fs_sap_trans Filesystem device='<NFS_Server>:<sap_trans_nfs_share>' directory='/usr/sap/trans' fstype='nfs' --clone interleave=true
[root]# pcs resource create s4h_fs_sap_sys Filesystem device='<NFS_Server>:<s4h_sys_nfs_share>' directory='/usr/sap/S4H/SYS' fstype='nfs' --clone interleave=true

After creating the Filesystem resources verify that they have started properly on all nodes.

[root]# pcs status
... 
 Clone Set: s4h_fs_sapmnt-clone [s4h_fs_sapmnt]
     Started: [ s4node1 s4node2 ]
 Clone Set: s4h_fs_sap_trans-clone [s4h_fs_sap_trans]
     Started: [ s4node1 s4node2 ]
 Clone Set: s4h_fs_sys-clone [s4h_fs_sys]
     Started: [ s4node1 s4node2 ]      
...

4.5.2. Configure shared filesystems managed outside of cluster

In case that shared filesystems will NOT be managed by cluster, it must be ensured that they are available before the pacemaker service is started.

In RHEL 7 due to systemd parallelization you must ensure that shared filesystems are started in resource-agents-deps target. More details on this can be found in documentation section 9.6. Configuring Startup Order for Resource Dependencies not Managed by Pacemaker (Red Hat Enterprise Linux 7.4 and later).

4.6. Configure ASCS resource group

Create group with ASCS20 filesystem, IP address and ASCS20 instance.

# pcs resource create s4h_fs_ascs20 Filesystem device='<NFS_Server>:<s4h_ascs20_nfs_share>' directory=/usr/sap/S4H/ASCS20 fstype=nfs force_unmount=safe --group s4h_ASCS20_group
# pcs resource create s4h_vip_ascs20 IPaddr2 ip=192.168.200.201 --group s4h_ASCS20_group
# pcs resource create s4h_ascs20 SAPInstance InstanceName="S4H_ASCS20_s4ascs" START_PROFILE=/sapmnt/S4H/profile/S4H_ASCS20_s4ascs AUTOMATIC_RECOVER=false meta resource-stickiness=5000 --group s4h_ASCS20_group

Note: meta resource-stickiness=5000 is here to balance out the failover constraint with ERS so the resource stays on the node where it started and doesn't migrate around cluster uncontrollably.

4.7. Configure ERS resource group

Create group with ERS29 filesystem and IP address.

# pcs resource create s4h_fs_ers29 Filesystem device='<NFS_Server>:<s4h_ers29_nfs_share>' directory='/usr/sap/S4H/ERS29' fstype=nfs force_unmount=safe --group s4h_ERS29_group
# pcs resource create s4h_vip_ers29 IPaddr2 ip=192.168.200.202 --group s4h_ERS29_group

4.8. Create constraints

  1. s4h_ASCS20_group and s4h_ERS29_group should try to avoid running on same node. Order of groups matters.

    # pcs constraint colocation add s4h_ERS29_group with s4h_ASCS20_group -5000
    
  2. Prefer to start ASCS20 before the ERS29 (optionally)

    # pcs constraint order s4h_ASCS20_group then s4h_ERS29_group symmetrical=false kind=Optional
    

4.9 Add the ERS29 instance to ERS29 group

# pcs resource create s4h_ers29 SAPInstance InstanceName="S4H_ERS29_s4ers" START_PROFILE=/sapmnt/S4H/profile/S4H_ERS29_s4ers AUTOMATIC_RECOVER=false IS_ERS=true --group s4h_ERS29_group

5. Test the cluster configuration

5.1. Check the constraints

# pcs constraint
Location Constraints:
Ordering Constraints:
  start s4h_ASCS20_group then start s4h_ERS29_group (kind:Optional) (non-symmetrical)
Colocation Constraints:
  s4h_ERS29_group with s4h_ASCS20_group (score:-5000)
Ticket Constraints:

5.2. Failover ASCS due to node crash

Before the crash, ASCS is running on s4node1 while ERS running on s4node2.

# pcs status
... 
 Resource Group: s4h_ASCS20_group
     s4h_fs_ascs20  (ocf::heartbeat:Filesystem):    Started s4node1
     s4h_vip_ascs20 (ocf::heartbeat:aws-vpc-move-ip):   Started s4node1
     s4h_ascs20 (ocf::heartbeat:SAPInstance):   Started s4node1
 Resource Group: s4h_ERS29_group
     s4h_fs_ers29   (ocf::heartbeat:Filesystem):    Started s4node2
     s4h_vip_ers29  (ocf::heartbeat:aws-vpc-move-ip):   Started s4node2
     s4h_ers29  (ocf::heartbeat:SAPInstance):   Started s4node2
...

On s4node2, run the following command to monitor the status changes in the cluster:

[root@s4node2 ~]# crm_mon -Arf

Crash s4node1 by running the following command. Please note that connection to s4node1 will be lost after the command.

[root@s4node1 ~]# echo c > /proc/sysrq-trigger

On s4node2, monitor the failover process. After failover, cluster should be in such state, with ASCS and ERS both on s4node2.

[root@s4node2 ~]# pcs status
...
 Resource Group: s4h_ASCS20_group
     s4h_fs_ascs20  (ocf::heartbeat:Filesystem):    Started s4node2
     s4h_vip_ascs20 (ocf::heartbeat:aws-vpc-move-ip):   Started s4node2
     s4h_ascs20 (ocf::heartbeat:SAPInstance):   Started s4node2
 Resource Group: s4h_ERS29_group
     s4h_fs_ers29   (ocf::heartbeat:Filesystem):    Started s4node2
     s4h_vip_ers29  (ocf::heartbeat:aws-vpc-move-ip):   Started s4node2
     s4h_ers29  (ocf::heartbeat:SAPInstance):   Started s4node2
...

5.3. ERS moves to the previously failed node

Bring s4node1 back online, and start the cluster:

[root@s4node1 ~]# pcs cluster start

ERS should move to s4node1, while ASCS remaining on s4node2. Wait for ERS to finish the migration, and at the end the cluster should be in such state:

[root@node1 ~]# pcs status
...
 Resource Group: s4h_ASCS20_group
     s4h_fs_ascs20  (ocf::heartbeat:Filesystem):    Started s4node2
     s4h_vip_ascs20 (ocf::heartbeat:aws-vpc-move-ip):   Started s4node2
     s4h_ascs20 (ocf::heartbeat:SAPInstance):   Started s4node2
 Resource Group: s4h_ERS29_group
     s4h_fs_ers29   (ocf::heartbeat:Filesystem):    Started s4node1
     s4h_vip_ers29  (ocf::heartbeat:aws-vpc-move-ip):   Started s4node1
     s4h_ers29  (ocf::heartbeat:SAPInstance):   Started s4node1
...

6. Enable cluster to auto-start after reboot

The cluster is not yet enabled to auto-start after reboot. System admin needs to manually start the cluster after the node is fenced and rebooted. After testing the previous section, when everything works fine, enable the cluster to auto-start after reboot:

# pcs cluster enable --all

Now please rerun the tests in previous section to make sure that cluster still works fine. Please note that in section 5.3., there is no need to run command pcs cluster start after a node is rebooted. Cluster should automatically start after reboot.

By this point you have successfully configured a two-node cluster for ENSA2. You can either continue with intensive testing to get ready for production, or optionally add more nodes to the cluster.

7. Optional: Multi-node cluster

It's an option to run a multi-node cluster. However, as the complexity of the cluster increases, please design carefully following Red Hat support policies. It's recommended to work with a Red Hat cluster consultant.

7.1. Quorum Policy

The options for quorum vary depending on the configuration. Please review the configuration guidances.

Note: below is the example of adding a third node to the previously configured two-node cluster, given the assumption that quorum policy will be properly configured.

7.2. OS Configuration

Create a node that's identical to the first two nodes, in terms of resources, RHEL for SAP Solutions subscription, OS configurations, etc. If you can clone the node from the other cluster node, that's preferred.

In the example, the hostname of the node is s4node3. Make sure the /etc/hosts on each cluster node contains all cluster nodes and the virt. IP's of the SAP instances.

7.3. Create users

Create the following groups and users that are identical to other two nodes. For example:

Groups in /etc/group:
sapsys:x:1010:
sapinst:x:1011:root,s4hadm

Users in /etc/passwd:
s4hadm:x:1020:1010:SAP System Administrator:/home/s4hadm:/bin/csh
sapadm:x:1001:1010:SAP System Administrator:/home/sapadm:/bin/false

7.4. Create the mount points

Create the following mount points, you don't have to mount the file systems.

/usr/sap/S4H/ASCS20
/usr/sap/S4H/ERS29
/usr/sap/S4H/SYS
/usr/sap/trans
/sapmnt

7.5. Install pacemaker

# yum -y install pcs pacemaker

7.6. Add the node to the cluster

On one node of the existing cluster s4ha, add the third node:

# pcs cluster auth s4node3
Username: hacluster
Password:

# pcs cluster node add s4node3

7.7. Update STONITH to include the 3rd node

Depending on the STONITH setup, you may need to update the STONITH resource to include the 3rd node.

Test if fencing works properly on the 3rd node.

[root@s4node1 ~]# pcs stonith fence s4node3

After fencing, remember to manually start cluster, because cluster is not yet configured to auto-start at boot:

[root@s4node3 ~]# pcs cluster start

7.8. Update ERS resource

meta resource-stickiness=5000 is here to ensure that resource ERS stays on the node where it started and doesn't migrate around cluster uncontrollably.

# pcs resource meta s4h_ers29 resource-stickiness=5000

7.9. Test failover

7.9.1. Failover ASCS due to node crash

Before the crash, ASCS is running on s4node1 while ERS running on s4node2.

On s4node2, run the following command to monitor the status changes in the cluster:

[root@s4node2 ~]# crm_mon -Arf

Crash s4node1 by running the following command. Please note that connection to s4node1 will be lost after the command.

[root@s4node1 ~]# echo c > /proc/sysrq-trigger

On s4node2, monitor the failover process. After failover, cluster should be in such state, with ASCS running on s4node3, and ERS remaining on s4node2.

[root@s4node2 ~]# pcs status
...
 Resource Group: s4h_ASCS20_group
     s4h_fs_ascs20  (ocf::heartbeat:Filesystem):    Started s4node3
     s4h_vip_ascs20 (ocf::heartbeat:aws-vpc-move-ip):   Started s4node3
     s4h_ascs20 (ocf::heartbeat:SAPInstance):   Started s4node3
 Resource Group: s4h_ERS29_group
     s4h_fs_ers29   (ocf::heartbeat:Filesystem):    Started s4node2
     s4h_vip_ers29  (ocf::heartbeat:aws-vpc-move-ip):   Started s4node2
     s4h_ers29  (ocf::heartbeat:SAPInstance):   Started s4node2
...

7.9.2. ERS remains on current node

Bring s4node1 back online, ERS should remain on current node, instead of moving back to s4node1.

7.9.3. Test ERS crash

Similarly, test crash the node where ERS is running. ERS group should failover to the spare node while ASCS remaining intact on its current node. After the crashed node is back, the ERS group should not move back.

7.10. Enable cluster to auto-start after reboot

[root@s4node3 ~]# pcs cluster enable