Implementing the Python hook SAPHanaSR in RHEL - SAP HANA on Amazon
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Implementing the Python hook SAPHanaSR in RHEL

As a <sid>adm user, stop the SAP HANA databases on both nodes, either with HDB or using sapcontrol, before proceeding further with changes, as seen in the following example.

hdbadm@prihana> sapcontrol -nr NN -function StopSystem

As a root user, copy the hook from the SAPHanaSR package into a read/writable directory on both nodes, as shown in the following example.

[root@prihana ~]# mkdir -p /hana/shared/myHooks [root@prihana ~]# cp /usr/share/SAPHanaSR/srHook/ /hana/shared/myHooks [root@prihana ~]# chown -R hdbadm:sapsys /hana/shared/myHooks

Update the global.ini file on each node to enable use of the hook script by both SAP HANA instances. Ensure that you make a copy/backup of global.ini before updating the file.

See the following example for updating the global.ini at location (/hana/shared/HDB/global/hdb/custom/config/global.ini):

[ha_dr_provider_SAPHanaSR] provider = SAPHanaSR path = /hana/shared/myHooks 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 user to access the cluster attributes. To enable this, 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 Defaults!SOK_SITEA, SFAIL_SITEA, SOK_SITEB, SFAIL_SITEB !requiretty

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.