Implementing Python hook SAPHanaSR in SLES - SAP HANA on AWS

Implementing Python hook SAPHanaSR in SLES

Use the hook from the SAPHanaSR package. Optionally, you can copy it to your preferred directory; for example, /hana/share/myHooks. The hook must be available on all SAP HANA cluster nodes.

Stop the SAP HANA database, either with HDB or using sapcontrol, before proceeding further with changes, as shown in the following example.

hdbadm@prihana> sapcontrol -nr <instance_number> -function StopSystem

Update theĀ global.iniĀ file located at the /hana/shared/<SID>/global/hdb/custom/config/ directory on each node to enable the use of the hook script by both SAP HANA instances. Ensure that you make a copy/backup of global.inibefore updating the file.

[ha_dr_provider_SAPHanaSR] provider = SAPHanaSR path = /usr/share/SAPHanaSR execution_order = 1 [trace] ha_dr_saphanasr = info

The current version of the SAPHanaSR python hook uses the command sudo to allow the <sid>adm to access the cluster attributes. To enable this, edit and update the file /etc/sudoers as a root user with entries as shown in the following example:

# SAPHanaSR-ScaleUp entries for writing srHook cluster attribute Cmnd_Alias SOK_SITEA = /usr/sbin/crm_attribute -n hana_hdb_site_srHook_PRI -v SOK -t crm_config -s SAPHanaSR Cmnd_Alias SFAIL_SITEA = /usr/sbin/crm_attribute -n hana_hdb_site_srHook_PRI -v SFAIL -t crm_config -s SAPHanaSR Cmnd_Alias SOK_SITEB = /usr/sbin/crm_attribute -n hana_hdb_site_srHook_SEC -v SOK -t crm_config -s SAPHanaSR Cmnd_Alias SFAIL_SITEB = /usr/sbin/crm_attribute -n hana_hdb_site_srHook_SEC -v SFAIL -t crm_config -s SAPHanaSR hdbadm ALL=(ALL) NOPASSWD: SOK_SITEA, SFAIL_SITEA, SOK_SITEB, SFAIL_SITEB
Note

hdb is the SAP HANA system ID used in the given example. You must replace hdb with lowercase SID of your SAP HANA installation. Replace the PRI and SEC references with your SAP HANA site names.