How to configure SAP HAlib for `SAPInstance` resources on RHEL 7 and 8?

Solution In Progress - Updated -

Environment

  • Red Hat Enterprise Linux 7 with High-Availability Add-on
  • Red Hat Enterprise Linux 8 with High-Availability Add-on
  • Pacemaker cluster running SAPInstance resources that are also managed by external tools such as SAP Management Console (MC/MMC) or SAP Landscape Management (LaMa)

Issue

  • How to allow SAP instances managed by SAPInstance to be controlled by tools outside of cluster, so cluster and the outside tools will coordinate with each other?
  • When an SAP instance is stopped by an external tool, cluster reacts to this situation and tries to start the SAP instance.

Resolution

When a system admin controls a SAP instance that is running inside the pacemaker cluster, either manually or using tools such as SAP Management Console (MC/MMC), the change needs to be done through the HA interface that's provided by the HA cluster software. SAP Start Service sapstartsrv controls the SAP instances, and needs to be configured to communicate with the pacemaker cluster software through the HA interface.

HA Interface

1. SAP Resource Agents and SAP Cluster Connector

To allow SAP instances to be managed by both the SAPInstance cluster resource agent and outside tools, the sap_cluster_connector must be implemented.

Following the requirements of SAP HA-Interface Certifications SAP NW-HA-CLU v750 and SAP S/4-HA-CLU v1.0, the minimum versions of resource agents and sap_cluster_connector are:

  • resource-agents-sap-4.1.1-12.el7_6.19
  • resource-agents-4.1.1-12.el7_6.19
  • sap-cluster-connector-3.0.1-1.el7_6.5

Run the following commands on both cluster nodes:

# yum install resource-agents-4.1.1-12.el7_6.19 resource-agents-sap-4.1.1-12.el7_6.19
# yum install sap-cluster-connector-3.0.1-1.el7_6.5

2. Configurations

2.1. Add the SAP administrative user to haclient group so this user can interact with cluster. (Example below uses user rh2adm as example, adjust this for your environment). Run the following command on both cluster nodes.

# usermod -a -G haclient rh2adm

2.2. Modify start profiles of all SAP instances that should be managed by external tools. To do this add following lines to the end of the SAP instance start profile. Start profiles can be found in /sapmnt/<SID>/profiles directory. For example a start profile for system with SID RH2, ASCS instance with instance number 20 and virtula hostname rh2-ascs can be found in /sapmnt/RH1/profile/RH2_ASCS20_rh2-ascs.

service/halib = $(DIR_CT_RUN)/saphascriptco.so
service/halib_cluster_connector = /usr/bin/sap_cluster_connector

2.3. If the SAP instances are currently running in the cluster, disable them. (Example below uses resource name rh2_ascs20 and rh2_ers29)

# pcs resource disable rh2_ers29
# pcs resource disable rh2_ascs20

2.4. On each node of the cluster, stop the sapstartsrv process associated to these instances. You can determine which instance the sapstartsrv is related to by checking the pf attribute in process list pointing to start profile of the instance.

ASCS:

# ps aux|grep sapstartsrv|grep rh2adm
rh2adm     856  0.0  1.0 1107820 78524 ?       Ssl  13:42   0:09 /usr/sap/RH2/ASCS20/exe/sapstartsrv pf=/usr/sap/RH2/SYS/profile/RH2_ASCS20_ascs -D -u rh2adm

ERS:

# ps aux|grep sapstartsrv|grep rh2adm
rh2adm   18131  0.0  1.0 1039548 78564 ?       Ssl  13:06   0:08 /usr/sap/RH2/ERS29/exe/sapstartsrv pf=/sapmnt/RH2/profile/RH2_ERS29_ers -D -u rh2adm       

Stop the identified sapstartsrv process using the PID obtained from previous step. After the command, verify that startsapsrv processes has stopped.

# kill XXX

2.5. Re-enable the cluster resources and let the SAP instances to be started by SAPInstance resource agent. If there are issues starting the resources, check corresponding sapstartsrv.log and fix any error.

# pcs resource enable rh2_ascs20
# pcs resource enable rh2_ers29

2.6. Verify that sap_cluster_connector has been properly identified and loaded.

Check that startsapsrv.log file contains lines similar to following:

rh2adm > vi /usr/sap/RH2/ERS29/work/sapstartsrv.log
SAP HA Trace: === SAP_HA_InitEx2: SAP UNIX HA Lib 753, patch 201, changelist 1847707, optU (May 29 2018, 17:52:17) ===
SAP HA Trace: profile_params: setting cluster_connector = "/usr/bin/sap_cluster_connector"
SAP HA Trace: Fire system command /usr/bin/sap_cluster_connector init ...
SAP HA Trace: === SAP_HA_GetVersionInfo ===
SAP HA Trace: Fire system command /usr/bin/sap_cluster_connector gvi ...
SAP HA Trace: SAP_HA_GetVersionInfo HA interface version: 3
SAP HA Trace: SAP_HA_GetVersionInfo HAproduct: Pacemaker
SAP HA Trace: SAP_HA_GetVersionInfo SAPinterface: sap_cluster_connector
SAP HA Trace: SAP_HA_GetVersionInfo documentation: https://github.com/ClusterLabs/sap_cluster_connector
SAP HA Trace: --- SAP_HA_GetVersionInfo Exit-Code: SAP_HA_OK ---
SAP HA Trace: --- SAP_HA_InitEx2 Exit-Code: SAP_HA_OK ---

Check the output of sapcontrol. For example, on the node where ASCS is running, call sapcontrol using the instance number of the ASCS instance:

rh2adm > sapcontrol -nr 20 -function HACheckConfig

3. Upgrade from older release

The minimum version of sap_cluster_connector that complies with HA-Interface certification NW-HA-CLU 750 or S/4-HA-CLU 1.0 is 3.0.1-1.el7_6.5. Previous version of SAP Cluster Connector was delivered as part of the resource-agents-sap package and the name of the connector was sap_redhat_cluster_connector. When upgrading from older release, install sap_cluster_connector, and refer to step 2.2 to adjust the profiles accordingly.

4. Supported Databases

For supported databases by Pacemaker cluster on RHEL 7 and RHEL 8, please refer to the following documents:

Root Cause

sap_cluster_connector is a library that allows tools to control SAP Instances that are running inside a cluster, through HA Interface. If this library is not properly configured for a given SAP instance, pacemaker cluster that is managing this SAP instance will consider any change in the state of the SAP instance as an issue, and will take appropriate action to recover from such situation.

Implementing the sap_cluster_connector is not required if the SAP instance will only be managed by the cluster tools such as pcs or PCSD WEB GUI.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.