table of contents
susHanaSrMultiTarget.py(7) | SAPHanaSR-ScaleOut | susHanaSrMultiTarget.py(7) |
NAME¶
susHanaSrMultiTarget.py - Provider for multi-target aware SAP HANA srHook method srConnectionChanged().
DESCRIPTION¶
susHanaSrMultitarget.py can be used to provide a script for the SAP HANA srHook method srConnectionChanged().
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 srConnectionChanged() is called on the master nameserver as soon as one of the replicating services loses or establishes the system replication connection. This method is called only once.
SAPHanaSR srHook script and resource agent need to use same cluster attributes. Therefor beginning with package SAPHanaSR-ScaleOut version 0.180 a generation attribute is used.
SUPPORTED PARAMETERS¶
* The "HA/DR providers" API accepts the following mandatory parameters for the ha_dr_provider_saphanasrmultitarget section:
- [ha_dr_provider_sushanasrmultitarget]
- provider = susHanaSrMultiTarget
- path = /usr/share/SAPHanaSR-angi/
- execution_order = [ INTEGER ]
Further one optional parameter can be used to control which attributes the srHook script should access in the Linux cluster CIB. The following parameter should be set only if requested by support engineers. The default is sufficient for normal operation.
The "HA/DR providers" API accepts the following optional parameter for the system_replication section:
- [system_replication]
- register_secondaries_on_takeover = [ true | false ]
The "HA/DR providers" API accepts the following mandatory parameter for the trace section:
* The SAPHanaController RA recognizes the effecting system replication status via attributes in the CIB properties section. The SAP System Indentifier (sid) is given in lower case. See REQUIREMENTS section below for supported API versions and scenarios. For SAPHanaSR-angi the susHanaSrMultiTarget.py provides site-specific attributes among the SAPHanaSR properties:
Note: See SAPHanaSR.py(7) for old-style SAPHanaSR-ScaleOut with one global attribute instead of site-specific attributes.
* The SAPHanaSR-manageAttr tool recognises scale-out multi-target capability via host attribute. The SAP System Indentifier (sid) is given in lower case. See REQUIREMENTS section below for supported API versions and scenarios. For new SAPHanaSR-angi the susHanaSrMultiTarget.py reports its generation:
RETURN CODES¶
0 Successful program execution.
>0 Usage, syntax or execution errors.
EXAMPLES¶
* Example for generic permission in /etc/sudoers.d/SAPHanaSR .
HANA 2.0 Scale-Out, SID is SLE. The attribute contains the lowercase-SID. The
main srHook attribute and all auxiliary host- and site-attributes are
covered (..._gsh, ..._mts). Access should be always limited to the specific
SID.
# SAPHanaSR needs for srHook:
sleadm ALL=(ALL) NOPASSWD: /usr/sbin/crm_attribute -n hana_sle_*
* Example for looking up the sudo permission for the srHook
script.
All related files (/etc/sudoers and /etc/sudoers.d/*) are scanned. Example SID
is HA1.
* Example for entry in SAP HANA 2.0 global configuration
/hana/shared/$SID/global/hdb/custom/config/global.ini with multi-target
aware, site-specific attributes.
This entry is needed at both sites that are managed by the Linux cluster. The
HANA has to be stopped before the files can be edited. Do not copy the file
between nodes. Please check SAP HANA documentation for details. Do not
forget to adapt the sudo permission, see examples above.
provider = susHanaSrMultiTarget
path = /usr/share/SAPHanaSR-angi/
execution_order = 1
[trace]
ha_dr_saphanasrmultitarget = info
* Example for entry in SAP HANA 2.0 global configuration
/hana/shared/$SID/global/hdb/custom/config/global.ini to enable multi-target
aware third site.
This entry is needed to allow ocf_suse_SAPHanaController(7) parameter
AUTOMATED_REGISTER=true in multi-target environments. The HANA has to be
stopped before the files can be edited. Do not copy the file between nodes.
Please check SAP HANA documentation for details.
...
register_secondaries_on_takeover = true
...
* Example for entry in SAP HANA 2.0 nameserver configuration
/hana/shared/$SID/global/hdb/custom/config/nameserver.ini for two-node
scale-out HANA without standby nodes.
This entry is needed at both sites that are managed by the Linux cluster. The
HANA has to be stopped before the files can be edited. Do not copy the file
between nodes. It might be necessary to un-register and re-register the
secondary to make the change effective on the secondary site. Please check
SAP HANA documentation for details. In this example the master node is
suse11, the worker is suse12.
...
master = suse11:31001
worker = suse11 suse12
active_master = suse11:31001
roles_suse11 = worker
roles_suse12 = worker
...
* Example for checking the system log for srHook setting HANA system replication status in the CIB properties section. To be executed on respective HANA primary site's master nameserver.
* Example for checking the HANA tracefiles for srConnectionChanged() events. To be executed on respective HANA primary site's master nameserver.
~> cdtrace
~> grep susHanaS.*srConnectionChanged.*called nameserver_*.trc
~> grep crm_attribute.*susHanaS nameserver_*.trc
# exit
* Example for checking the HANA tracefiles for when the hook script has been loaded. To be executed on both site's master nameservers.
~> cdtrace
~> grep HADR.*load.*susHanaS nameserver_*.trc
* Example for comparing Linux cluster srHook attribute with current HANA SR state. SID is HA1. To be executed on current HANA primary site.
# su - ha1adm -c "HDBSettings.sh systemReplicationStatus.py"
* Potentially dangerous example for manually changing Linux
cluster srHook attribute according to current HANA SR state. This might be
desired if the HANA SR state has changed while the Linux cluster was
completely down. SID is ICE, site is BERG, current HANA SR state is SFAIL.
Note: Understand the impact before trying.
# cs_clusterstate -i
# crm_attribute -n hana_ice_site_srHook_BERG -v SFAIL -t crm_config -s SAPHanaSR
# SAPHanaSR-showAttr
* Example for removing orphaned global srHook attribute. This might be done after upgrading from old-style srHook, to avoid confusion caused by different HANA HADR provider API versions. See also SAPHanaSR.py(7) and SAPHanaSR-manageAttr(8). SID is HA1.
# cs_clusterstate -i
crm configure show SAPHanaSR
# crm_attribute --delete -t crm_config --name hana_ha1_glob_srHook
crm configure show SAPHanaSR
# SAPHanaSR-showAttr
FILES¶
- /usr/share/SAPHanaSR-angi/susHanaSrMultiTarget.py
- the scale-out multi-target aware hook provider, delivered with the RPM
- /hana/shared/$SID/global/hdb/custom/config/global.ini
- the on-disk representation of HANA global system configuration
- /hana/shared/$SID/global/hdb/custom/config/nameserver.ini
- the on-disk representation of HANA nameserver configuration
- /etc/sudoers , /etc/sudoers.d/
- the sudo permission configuration
- /usr/sap/$SID/HDB$nr/$host/trace/
- the directory with HANA trace files
- /usr/sap/$SID/HDB$nr/.crm_attribute.$SITE
- the internal cache for srHook status changes while Linux cluster is down, file is owned and read/write by ${sid}adm and must never be touched
REQUIREMENTS¶
1. SAP HANA starting with version 1.0 SPS11 patch level 112.02. Older versions do not provide the srHook method srConnectionChanged(). With the mentioned HANA versions uni-directional chained system replication is possible. With HANA 2.0 SPS04 and later multi-target system replication is possible as well. See also SAPHanaSR-ScaleOut(7) for supported API versions and scenarios.
2. No other HADR provider hook script should be configured for the srConnectionChanged() method. Hook scripts for other methods, provided in SAPHanaSR-angi, can be used in parallel to susHanaSrMultiTarget.py, if not documented contradictingly.
3. The user ${sid}adm needs execution permission as user root for the command crm_attribute.
4. The hook provider needs to be added to the HANA global configuration, in memory and on disk (in persistence).
5. The Linux cluster needs to be up and running to allow HA/DR provider events being written into CIB attributes. The current HANA SR status might differ from CIB srHook attribute after Linux cluster maintenance.
6. The srHook script runtime almost completely depends on call-outs to OS and Linux cluster.
7. Running srHook script and RA need to be of same or compatible generation. This is indicated by node attributes.
BUGS¶
Old SAPHanaSR/SAPHanaSR-ScaleOut and new SAPHanaSR-angi properties
for HANA SR status can not be used at same time.
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-ScaleOut(7) , susHanaSR.py(7) ,
ocf_suse_SAPHanaTopology(7) , ocf_suse_SAPHanaController(7) ,
SAPHanaSR-showAttr(8) , SAPHanaSR-manageAttr(8) ,
SAPHanaSR-manageProvider(8) , crm_attribute(8) ,
sudo(8) , sudoers(5) , python(8) ,
https://documentation.suse.com/sbp/sap/ ,
https://documentation.suse.com/sles-sap/ ,
https://www.susecon.com/archive-2019.html ,
https://www.susecon.com/archive-2020.html ,
https://www.suse.com/support/kb/doc/?id=000020835
http://help.sap.com/saphelp_hanaplatform/helpdata/en/13/67c8fdefaa4808a7485b09815ae0f3/content.htm
,
http://help.sap.com/saphelp_hanaplatform/helpdata/en/5d/f2e766549a405e95de4c5d7f2efc2d/content.htm
,
http://help.sap.com/saphelp_hanaplatform/helpdata/en/12/00ab8ef0c54c54be2d0e7f5327f7ed/content.htm?frameset=/en/13/67c8fdefaa4808a7485b09815ae0f3/frameset.htm¤t_toc=/en/00/0ca1e3486640ef8b884cdf1a050fbb/plain.htm&node_id=413
,
https://help.sap.com/saphelp_hanaplatform/helpdata/en/3f/1a6a7dc31049409e1a9f9108d73d51/content.htm
AUTHORS¶
A.Briel, F.Herschel, L.Pinne.
COPYRIGHT¶
(c) 2020-2025 SUSE LLC
susHanaSrMultiTarget.py comes with ABSOLUTELY NO WARRANTY.
For details see the GNU General Public License at
http://www.gnu.org/licenses/gpl.html
10 Dec 2025 |