susHanaSR.py(7)
π susHanaSR.py β like, the whole manual, but make it make sense π
okay so. bestie. this is the manual page for susHanaSR.py(7) from the SAPHanaSR fam β it's a hook provider, and by the end of this you're gonna be obsessed. grab a snack π, we're going in.
β¨ NAME β¨
susHanaSR.py β the provider for SAP HANA's srHook method srConnectionChanged(). that's the whole vibe.
πΈ DESCRIPTION πΈ
so susHanaSR.py exists so you can hand SAP HANA a script for the srHook method srConnectionChanged(). that's literally its job, and it does it slayfully.
here's the lore: the SAP HANA nameserver ships a Python-based API called "HA/DR providers", and it gets called at the big main-character moments of host auto-failover and system replication takeover. these things are called hooks, and you can use them to do whatever arbitrary operations your heart desires. the method srConnectionChanged() gets called on the master nameserver the moment one of the replicating services loses or establishes the system replication connection. and like β it's called only once. one shot. no reruns. π¬
what susHanaSR.py actually does: it updates the cluster attribute srHook whenever the HANA system replication status changes. which means this attribute is more reliable than the sync_state attribute (that one gets polled by RA monitors, which is giving secondhand information ngl).
π«Ά heads up bestie: this hook script needs to be configured and activated on all HANA nodes. all of them. no skipping.
π SUPPORTED PARAMETERS π
the ha_dr_provider_sushanasr section
the "HA/DR providers" API accepts these parameters for the ha_dr_provider_sushanasr section, and here's the section header itself, iconic:
[ha_dr_provider_sushanasr]
provider = susHanaSRβ Mandatory. Must not be changed. like, do not touch. πpath = /usr/share/SAPHanaSR-angiβ Mandatory. Please change only if requested.execution_order = [ INTEGER ]β Mandatory. the order might depend on other hook scripts, so think about it.
the trace section
the "HA/DR providers" API accepts this parameter for the trace section:
[trace]
ha_dr_sushanasr = [ info | debug ]β Optional. Will be added automatically if not set. the script's got you, fr fr.
the CIB side of things
the SAPHanaController RA recognizes the effecting system replication status via attributes in the CIB's SAPHanaSR properties section. the SAP System Identifier (sid) is given in lower case:
hana_${sid}_site_srHook_${site} = [ SOK | SFAIL | SWAIT ]
β Note: SAPHanaSR-ScaleOut comes with a SAPHanaSR.py that provides global attributes. different creature, same ecosystem.
π₯ RETURN CODES π₯
0β Successful program execution. we love a win. π>0β Usage, syntax or execution errors. something went sideways.
π¦ EXAMPLES π¦
buckle up, there's a lot, and honestly? all of them ate.
- example sudoers entry in
/etc/sudoers.d/SAPHanaSR:
# SAPHanaSR needs for srHook
ha1adm ALL=(ALL) NOPASSWD: /usr/sbin/crm_attribute -n
hana_ha1_site_srHook_*
- example for looking up the sudo permission for the srHook script. All related files (
/etc/sudoersand/etc/sudoers.d/*) are scanned. Example SID isHA1.
# sudo -U ha1adm -l | grep "NOPASSWD.*crm_attribute.*hana_ha1"
- example for checking HANA's python version. you'd do this before installing HADR provider hook scripts. SID is
HA1.
# su - ha1adm -c "python --version"
- example entry in the SAP HANA global configuration
/hana/shared/$SID/global/hdb/custom/config/global.ini. this file is needed at both sites, and HANA has to be stopped before the files can be edited. π
[ha_dr_provider_sushanasr]
provider = susHanaSR
path = /usr/share/SAPHanaSR-angi
execution_order = 1
[trace]
ha_dr_sushanasr = info
- example entry in the SAP HANA 2.0 global configuration
/hana/shared/$SID/global/hdb/custom/config/global.inito enable multi-target aware third site. this entry is needed to allow theocf_suse_SAPHanaController(7)parameterAUTOMATED_REGISTER=truein multi-target environments. 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.
[system_replication]
...
register_secondaries_on_takeover = true
...
- example entry in the SAP HANA 2.0 nameserver configuration
/hana/shared/$SID/global/hdb/custom/config/nameserver.inifor two-node scale-out HANA without standby nodes. this entry is needed at both sites that are managed by the Linux cluster. 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 issuse11, the worker issuse12, the instance number is00. see alsoSAPHanaSR-ScaleOut_basic_cluster(7).
[landscape]
...
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. run this on the respective HANA primary site's master nameserver.
# grep "sudo.*crm_attribute.*srHook" /var/log/messages
- example for checking the HANA tracefiles for
srConnectionChanged()events. also on the respective HANA primary site's master nameserver.
# su - sleadm
~> cdtrace
~> grep susHanaSR.srConnectionChanged.*called nameserver_*.trc
~> grep susHanaSR.*crm_attribute nameserver_*.trc
# exit
- example for checking the HANA tracefiles for when the hook script has been loaded. run this on both sites' master nameservers.
# su - sleadm
~> cdtrace
~> grep HADR.*load.*susHanaS nameserver_*.trc
- example for comparing the Linux cluster
srHookattribute with the current HANA SR state. SID isHA1. run on the current HANA primary site.
# SAPHanaSR-showAttr | grep -A4 srHook
# su - ha1adm -c "HDBSettings.sh systemReplicationStatus.py"
- potentially dangerous example for manually changing the Linux cluster
srHookattribute according to the current HANA SR state. you might want this if the HANA SR state changed while the Linux cluster was completely down. SID isICE, site isBERG, current HANA SR state isSFAIL.
π Note: Understand the impact before trying. like, actually understand it.
# su - iceadm -c "HDBSettings.sh systemReplicationStatus.py"
# cs_clusterstate -i
# crm_attribute -n hana_ice_site_srHook_BERG -v SFAIL -t crm_config -s
SAPHanaSR
# SAPHanaSR-showAttr
- example for removing an orphaned global srHook attribute. you'd do this after upgrading from old-style srHook, to avoid confusion caused by different HANA HADR provider API versions. SID is
HA1.
# SAPHanaSR-showAttr
# crm configure show SAPHanaSR
# cs_clusterstate -i
# crm_attribute --delete -t crm_config --name hana_ha1_glob_srHook
# crm configure show SAPHanaSR
# SAPHanaSR-showAttr
- example for temporarily blocking HANA system replication. this could be done for testing the HA/DR provider hook script integration.
π¨ Blocking the HANA system replication is dangerous. This test should not be done on production systems. Instance number is00, the resulting network ports are depending on the HANA setup. Please refer to SAP HANA documentation. See also manual pageiptables(8). Note: Understand the impact before trying.
- Check HANA and Linux cluster for clean idle state.
- On secondary, check for used network ports.
# ss -tulpan | grep hdb.*server | grep -v 127.0.0.1 |\
grep -v "\*" | awk '{print $6}' | awk -F: '{print $2}'
- On secondary, block HANA system replication, example ports are
4000[1237].
# iptables -I INPUT -p tcp -m multiport --ports
40001,40002,40003,40007 -j ACCEPT
Note: The ACCEPT needs to be replaced by appropriate action.
- Check the nameserver tracefile for
srConnectionChanged()events, check the system log forcrm_attributecalls, check the Linux cluster attributes forsrHookstatus. - On secondary, unblock HANA system replication.
# iptables -D INPUT -p tcp -m multiport --ports
40001,40002,40003,40007 -j DROP
- Check the nameserver tracefile for
srConnectionChanged()events, check the system log forcrm_attributecalls, check the Linux cluster attributes forsrHookstatus. - Check HANA and Linux cluster for clean idle state.
π§ FILES π§
/usr/share/SAPHanaSR-angi/susHanaSR.pyβ the hook provider, delivered with the RPM. the main character itself./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 permissions configuration./usr/sap/$SID/HDB$nr/$HOST/traceβ path to HANA tracefiles./usr/sap/$SID/HDB$nr/.crm_attribute.$SITEβ the internal cache for srHook status changes while the Linux cluster is down. file is owned and read/write by${sid}admand must never be touched. π like, hands off. it's not yours.
π REQUIREMENTS π
- SAP HANA 2.0 SPS05 rev.059.04 or later provides Python 3 as well as the HA/DR provider hook method
srConnectionChanged()with multi-target aware parameters. the Python 3 and multi-target aware parameters are needed for the SAPHanaSR-angi package. both. you need both. - 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 tosusHanaSR.py, if not documented contradictingly. sharing is caring, but only where it's allowed. π«Ά - The user
${sid}admneeds execution permission as user root for the commandcrm_attribute. - The user
${sid}admneeds ownership and read/write permission on the internal cache file/usr/sap/$SID/HDB$nr/.crm_attribute.$SITEand its parent directory. - The hook provider needs to be added to the HANA global configuration β in memory and on disk (in persistence). both. it's giving "don't forget the persistence, bestie".
- The srHook script runtime almost completely depends on call-outs to the OS and the Linux cluster. that's just how it is.
β BUGS β
in case of any problem, please use your favourite SAP support process to open a request for the component BC-OP-LNX-SUSE. and please report any other feedback and suggestions to feedback@suse.com. we're listening, fr fr.
π SEE ALSO π
SAPHanaSR-angi(7) , ocf_suse_SAPHanaTopology(7) , ocf_suse_SAPHanaController(7) , ocf_heartbeat_IPaddr2(7) , susCostOpt.py(7) , susTkOver.py(7) , susChkSrv.py (7) , SAPHanaSR-showAttr(8) , SAPHanaSR-manageProvider(8) , SAPHanaSR-hookHelper(8) , crm_attribute(8) , sudo(8) , sudoers(5), python(8) , iptables(8) , ss(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. legends, honestly.
π COPYRIGHT π
(c) 2015-2017 SUSE Linux GmbH, Germany. (c) 2018-2026 SUSE LLC
susHanaSR.py comes with ABSOLUTELY NO WARRANTY. For details see the GNU General Public License at http://www.gnu.org/licenses/gpl.html
okay that's the whole page, no skips, no cap π
tysm for reading bestie β this was susHanaSR.py(7) from SAPHanaSR, dated 10 Jan 2025, and she's iconic. mwah. ππ
π¦ where this page comes from
- opensuse-leap 16.0: SAPHanaSR-angi 1.3.4-160000.1.1 Β· GPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms