Scroll to navigation

susTkOver.py(7) SAPHanaSR susTkOver.py(7)

NAME

susTkOver.py - Provider for SAP HANA srHook method preTakeover().

DESCRIPTION

susTkOver.py can be used to provide a script for the SAP HANA srHook method preTakeover().

The SAP HANA nameserver provides a Python-based API ("HA/DR providers"), which is called at important points of the host auto-failover and system replication takeover process. These so called hooks can be used for arbitrary operations that need to be executed. The method preTakeover() is called before the sr_takeover action.

susTkOver.py allows manual takeover of the HANA primary if the SAP HANA multi-state resource (managed by SAPHanaController) is set into maintenance or the Linux cluster is stopped. Otherwise the manual takeover is blocked. See also manual page SAPHanaSR_maintenance_examples(7).

This hook script needs to be configured and activated on all HANA nodes.

SUPPORTED PARAMETERS

* The "HA/DR providers" API accepts the following parameters for the ha_dr_provider_susTkOver section:

[ha_dr_provider_susTkOver]
Mandatory. Must not be changed.
Mandatory. Delivered within RPM package. Please change only if requested.
Mandatory. Order might depend on other hook scripts.
Optional. Default is 30 seconds.

* The "HA/DR providers" API accepts the following parameter for the trace section:

[trace]
Optional. Default is info. Will be added automatically, if not set.

* The SAPHanaController RA is recognizing the pending takeover request via the following cluster attributes:

HANA system replication takeover action, indicated by preTakeover().

The node attribute system replication action is checked by the HA/DR provider API method preTakeover(). It is set by the resource agent SAPHanaController. It indicates whether a takeover or registration is ongoing.
T = Takeover on new primary (sr_takeover) ongoing.
R = Registration on new secondary (sr_register) ongoing.
F = Takeover failed.
- = No action pending.

HANA system replication action history

The node attribute system replication action history stores actions in CIB attributes for later use, for root cause analysis.

RETURN CODES

0 Successful program execution.
>0 Usage, syntax or execution errors.

EXAMPLES

* Simple example for sudo permissions in /etc/sudoers.d/SAPHanaSR .
SID is HA1. See also manual page SAPHanaSR-hookHelper(8).

# SAPHanaSR needs for susTkOver
ha1adm ALL=(ALL) NOPASSWD: /usr/bin/SAPHanaSR-hookHelper *

* Example for looking up the sudo permission for the hook script.
All related files (/etc/sudoers and /etc/sudoers.d/*) are scanned. Example SID is HA1.

# sudo -U ha1adm -l | grep "NOPASSWD.*/usr/bin/SAPHanaSR-hookHelper"

* Example for entry in SAP HANA scale-up global configuration /hana/shared/$SID/global/hdb/custom/config/global.ini
This file is needed at both sites. The HANA has to be stopped before the files can be changed.

[ha_dr_provider_sustkover]
provider = susTkOver
path = /usr/share/SAPHanaSR-angi
sustkover_timeout = 30
execution_order = 1
[trace]
ha_dr_sustkover = info

* Example for entry in SAP HANA scale-out global configuration /hana/shared/$SID/global/hdb/custom/config/global.ini
This file is needed at both sites. The HANA has to be stopped before the files can be edited.

[ha_dr_provider_sustkover]
provider = susTkOver
path = /usr/share/SAPHanaSR-angi
sustkover_timeout = 30
execution_order = 1
[trace]
ha_dr_sustkover = info

* Example for checking the system log for susTkOver setting HANA system replication status in the CIB properties section. To be executed on respective HANA primary site's master nameserver.

# grep "sudo.*SAPHanaSR-hookHelper" /var/log/messages

* Example for checking the HANA tracefiles for preTakeover() events. To be executed on respective HANA secondary site's master nameserver.

# su - sleadm
~> cdtrace
~> grep susTk.*preTakeover.*called nameserver_*.trc

* Example for showing intentionally blocked manual takeover attempts. To be executed on respective HANA secondary site's master nameserver.

# su - sleadm
~> cdtrace
~> grep susTkOver.preTakeover.*failed.*50277 nameserver_*.trc

Note: If you see such messages, you may want to read SAPHanaSR_maintenance_examples(7).

* Example for checking the HANA tracefiles for when the hook script has been loaded. To be executed on both sites' master nameservers.

# su - sleadm
~> cdtrace
~> grep HADR.*load.*susTkOver nameserver_*.trc
~> grep susTkOver.init nameserver_*.trc

FILES

/usr/share/SAPHanaSR-angi/susTkOver.py
the hook provider, delivered with the RPM
/usr/bin/SAPHanaSR-hookHelper
the external script to check and update the CIB attribute
/hana/shared/$SID/global/hdb/custom/config/global.ini
the on-disk representation of HANA global system configuration
/etc/sudoers , /etc/sudoers.d/*
the sudo permissions configuration
/usr/sap/$sid/HDB$nr/$HOST/trace/nameserver_$vhost.3????.???.trc
the HANA master nameserver tracefile

REQUIREMENTS

1. SAP HANA 2.0 SPS06 or later provides the HA/DR provider hook method preTakeover() with multi-target aware parameters and separate return code for Linux HA clusters.

2. No other HADR provider hook script should be configured for the preTakeover() method. Hook scripts for other methods, provided in SAPHanaSR and SAPHanaSR-ScaleOut, can be used in parallel to susTkOver.py, if not documented contradictingly.

3. The user ${sid}adm needs execution permission as user root for the command SAPHanaSR-hookHelper

4. The hook provider needs to be added to the HANA global configuration, in memory and on disk (in persistence).

5. If the hook provider should be pre-compiled, the particular Python version that comes with SAP HANA has to be used.

BUGS

In case of any problem, please use your favourite SAP support process to open a request for the component BC-OP-LNX-SUSE. Please report any other feedback and suggestions to feedback@suse.com.

SEE ALSO

SAPHanaSR(7) , SAPHanaSR-ScaleOut(7) , susHanaSR.py(7) , susHanaSrMultiTarget.py(7) , ocf_suse_SAPHanaTopology(7) , ocf_suse_SAPHanaController(7) , SAPHanaSR-monitor(8) , SAPHanaSR-showAttr(8) , SAPHanaSR-hookHelper(8) , SAPHanaSR_maintenance_examples(7) , SAPHanaSR-manageProvider(8) , crm_attribute(8) , sudo(8) , sudoers(5), python3(8) ,
https://help.sap.com/docs/SAP_HANA_PLATFORM?locale=en-US
https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/5df2e766549a405e95de4c5d7f2efc2d.html?locale=en-US

AUTHORS

A.Briel, F.Herschel, L.Pinne.

COPYRIGHT

(c) 2022-2023 SUSE LLC
susTkOver.py comes with ABSOLUTELY NO WARRANTY.
For details see the GNU General Public License at http://www.gnu.org/licenses/gpl.html

20 Nov 2023