Skip to content

Commit 5174278

Browse files
committed
Add ChkSrv hook for HANA on RHEL pacemaker
1 parent 30a7198 commit 5174278

File tree

1 file changed

+28
-131
lines changed

1 file changed

+28
-131
lines changed

articles/sap/workloads/sap-hana-high-availability-rhel.md

Lines changed: 28 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -217,44 +217,7 @@ The steps in this section use the following prefixes:
217217
* [2593824 - Linux: Running SAP applications compiled with GCC 7.x](https://launchpad.support.sap.com/#/notes/2593824)
218218
* [2886607 - Linux: Running SAP applications compiled with GCC 9.x](https://launchpad.support.sap.com/#/notes/2886607)
219219

220-
1. **[A]** Install the SAP HANA.
221-
222-
To install SAP HANA System Replication, see [Automating SAP HANA Scale-Up System Replication using the RHEL HA Add-On](https://access.redhat.com/articles/3004101).
223-
224-
Run the **hdblcm** program from the HANA DVD. Enter the following values at the prompt:
225-
1. Choose installation: Enter **1**.
226-
1. Select additional components for installation: Enter **1**.
227-
1. Enter **Installation Path** [/hana/shared]: Select Enter.
228-
1. Enter **Local Host Name [..]**: Select Enter.
229-
1. **Do you want to add additional hosts to the system? (y/n)** [n]: Select Enter.
230-
1. Enter **SAP HANA System ID**: Enter the SID of HANA, for example: **HN1**.
231-
1. Enter **Instance Number** [00]: Enter the HANA Instance number. Enter **03** if you used the Azure template or followed the manual deployment section of this article.
232-
1. Select **Database Mode / Enter Index** [1]: Select Enter.
233-
1. Select **System Usage / Enter Index** [4]: Select the system usage value.
234-
1. Enter **Location of Data Volumes** [/hana/data]: Select Enter.
235-
1. Enter **Location of Log Volumes** [/hana/log]: Select Enter.
236-
1. **Restrict maximum memory allocation?** [n]: Select Enter.
237-
1. Enter **Certificate Host Name For Host '...'** [...]: Select Enter.
238-
1. Enter **SAP Host Agent User (sapadm) Password**: Enter the host agent user password.
239-
1. Confirm **SAP Host Agent User (sapadm) Password**: Enter the host agent user password again to confirm.
240-
1. Enter **System Administrator (hdbadm) Password**: Enter the system administrator password.
241-
1. Confirm **System Administrator (hdbadm) Password**: Enter the system administrator password again to confirm.
242-
1. Enter **System Administrator Home Directory** [/usr/sap/HN1/home]: Select Enter.
243-
1. Enter **System Administrator Login Shell** [/bin/sh]: Select Enter.
244-
1. Enter **System Administrator User ID** [1001]: Select Enter.
245-
1. Enter **ID of User Group (sapsys)** [79]: Select Enter.
246-
1. Enter **Database User (SYSTEM) Password**: Enter the database user password.
247-
1. Confirm **Database User (SYSTEM) Password**: Enter the database user password again to confirm.
248-
1. **Restart system after machine reboot?** [n]: Select Enter.
249-
1. **Do you want to continue? (y/n)**: Validate the summary. Enter **y** to continue.
250-
251-
1. **[A]** Upgrade the SAP Host Agent.
252-
253-
Download the latest SAP Host Agent archive from the [SAP Software Center][sap-swcenter] and run the following command to upgrade the agent. Replace the path to the archive to point to the file that you downloaded:
254-
255-
```bash
256-
sudo /usr/sap/hostctrl/exe/saphostexec -upgrade -archive <path to SAP Host Agent>;
257-
```
220+
1. **[A]** Install SAP HANA, following [SAP's documentation](https://help.sap.com/docs/SAP_HANA_PLATFORM/2c1988d620e04368aa4103bf26f17727/2d4de94c8bf14cda8d37278647fff8ab.html).
258221

259222
1. **[A]** Configure the firewall.
260223

@@ -285,8 +248,6 @@ The steps in this section use the following prefixes:
285248

286249
1. **[1]** Create the tenant database.
287250

288-
If you're using SAP HANA 2.0 or MDC, create a tenant database for your SAP NetWeaver system. Replace **NW1** with the SID of your SAP system.
289-
290251
Run the following command as <hanasid\>adm:
291252

292253
```bash
@@ -350,77 +311,6 @@ The steps in this section use the following prefixes:
350311
# site name: SITE1
351312
```
352313

353-
## Configure SAP HANA 1.0 System Replication
354-
355-
The steps in this section use the following prefixes:
356-
357-
* **[A]**: The step applies to all nodes.
358-
* **[1]**: The step applies to node 1 only.
359-
* **[2]**: The step applies to node 2 of the Pacemaker cluster only.
360-
361-
1. **[A]** Configure the firewall.
362-
363-
Create firewall rules to allow HANA System Replication and client traffic. The required ports are listed on [TCP/IP Ports of All SAP Products](https://help.sap.com/viewer/ports). The following commands are just an example to allow HANA 2.0 System Replication. Adapt it to your SAP HANA 1.0 installation.
364-
365-
```bash
366-
sudo firewall-cmd --zone=public --add-port=40302/tcp --permanent
367-
sudo firewall-cmd --zone=public --add-port=40302/tcp
368-
```
369-
370-
1. **[1]** Create the required users.
371-
372-
Run the following command as root. Make sure to replace the values for HANA System ID (for example, **HN1**), instance number (**03**), and any usernames, with the values of your SAP HANA installation:
373-
374-
```bash
375-
PATH="$PATH:/usr/sap/HN1/HDB03/exe"
376-
hdbsql -u system -i 03 'CREATE USER hdbhasync PASSWORD "passwd"'
377-
hdbsql -u system -i 03 'GRANT DATA ADMIN TO hdbhasync'
378-
hdbsql -u system -i 03 'ALTER USER hdbhasync DISABLE PASSWORD LIFETIME'
379-
```
380-
381-
1. **[A]** Create the keystore entry.
382-
383-
Run the following command as root to create a new keystore entry:
384-
385-
```bash
386-
PATH="$PATH:/usr/sap/HN1/HDB03/exe"
387-
hdbuserstore SET hdbhaloc localhost:30315 hdbhasync passwd
388-
```
389-
390-
1. **[1]** Back up the database.
391-
392-
Back up the databases as root:
393-
394-
```bash
395-
PATH="$PATH:/usr/sap/HN1/HDB03/exe"
396-
hdbsql -d SYSTEMDB -u system -i 03 "BACKUP DATA USING FILE ('initialbackup')"
397-
```
398-
399-
If you use a multitenant installation, also back up the tenant database:
400-
401-
```bash
402-
hdbsql -d HN1 -u system -i 03 "BACKUP DATA USING FILE ('initialbackup')"
403-
```
404-
405-
1. **[1]** Configure system replication on the first node.
406-
407-
Create the primary site as <hanasid\>adm:
408-
409-
```bash
410-
su - hdbadm
411-
hdbnsutil -sr_enable –-name=SITE1
412-
```
413-
414-
1. **[2]** Configure system replication on the secondary node.
415-
416-
Register the secondary site as <hanasid\>adm:
417-
418-
```bash
419-
HDB stop
420-
hdbnsutil -sr_register --remoteHost=hn1-db-0 --remoteInstance=03 --replicationMode=sync --name=SITE2
421-
HDB start
422-
```
423-
424314
## Create a Pacemaker cluster
425315

426316
Follow the steps in [Setting up Pacemaker on Red Hat Enterprise Linux in Azure](high-availability-guide-rhel-pacemaker.md) to create a basic Pacemaker cluster for this HANA server.
@@ -430,34 +320,23 @@ Follow the steps in [Setting up Pacemaker on Red Hat Enterprise Linux in Azure](
430320
>
431321
> When using HA solutions to manage SAP HANA system replication in combination with systemd-enabled SAP HANA instances (refer to SAP Note [3189534](https://me.sap.com/notes/3189534)), additional steps are necessary to ensure that the HA cluster can manage the SAP instance without systemd interference. So, for SAP HANA system integrated with systemd, additional steps outlined in [Red Hat KBA 7029705](https://access.redhat.com/solutions/7029705) must be followed on all cluster nodes.
432322
433-
## Implement the Python system replication hook SAPHanaSR
323+
## Implement SAP HANA system replication hooks
434324

435-
This important step optimizes the integration with the cluster and improves the detection when a cluster failover is needed. We highly recommend that you configure the SAPHanaSR Python hook.
325+
This important step optimizes the integration with the cluster and improves the detection when a cluster failover is needed. It is mandatory for correct cluster operation to enable the SAPHanaSR hook. We highly recommend that you configure both SAPHanaSR and ChkSrv Python hooks.
436326

437-
1. **[A]** Install the SAP HANA resource agents on **all nodes**. Make sure to enable a repository that contains the package. You don't need to enable more repositories, if you're using an RHEL 8.x HA-enabled image.
327+
1. **[A]** Install the SAP HANA resource agents on **all nodes**. Make sure to enable a repository that contains the package. You don't need to enable more repositories, if you're using an RHEL 8.x or higher HA-enabled image.
438328

439329
```bash
440330
# Enable repository that contains SAP HANA resource agents
441331
sudo subscription-manager repos --enable="rhel-sap-hana-for-rhel-7-server-rpms"
442332

443-
sudo yum install -y resource-agents-sap-hana
333+
sudo dnf install -y resource-agents-sap-hana
444334
```
445335

446336
> [!NOTE]
447337
> For RHEL 8.x and RHEL 9.x, verify that the installed resource-agents-sap-hana package is version 0.162.3-5 or later.
448338
449-
1. **[A]** Install the HANA `system replication hook`. The hook needs to be installed on both HANA DB nodes.
450-
451-
> [!TIP]
452-
> The Python hook can only be implemented for HANA 2.0.
453-
454-
1. Prepare the hook as `root`.
455-
456-
```bash
457-
mkdir -p /hana/shared/myHooks
458-
cp /usr/share/SAPHanaSR/srHook/SAPHanaSR.py /hana/shared/myHooks
459-
chown -R hn1adm:sapsys /hana/shared/myHooks
460-
```
339+
1. **[A]** Install the HANA `system replication hooks`. The configuration for the replication hooks needs to be installed on both HANA DB nodes.
461340

462341
1. Stop HANA on both nodes. Run as <sid\>adm.
463342

@@ -470,13 +349,24 @@ This important step optimizes the integration with the cluster and improves the
470349
```output
471350
[ha_dr_provider_SAPHanaSR]
472351
provider = SAPHanaSR
473-
path = /hana/shared/myHooks
352+
path = /usr/share/SAPHanaSR/srHook
474353
execution_order = 1
475-
354+
355+
[ha_dr_provider_chksrv]
356+
provider = ChkSrv
357+
path = /usr/share/SAPHanaSR/srHook
358+
execution_order = 2
359+
action_on_lost = kill
360+
476361
[trace]
477362
ha_dr_saphanasr = info
363+
ha_dr_chksrv = info
478364
```
479365

366+
If you point parameter `path` to the default `/usr/share/SAPHanaSR/srHook` location, the Python hook code updates automatically through OS updates or package updates. HANA uses the hook code updates when it next restarts. With an optional own path like `/hana/shared/myHooks`, you can decouple OS updates from the hook version that HANA will use.
367+
368+
You can adjust the behavior of `ChkSrv` hook by using the `action_on_lost` parameter. Valid values are [ `ignore` | `stop` | `kill` ].
369+
480370
1. **[A]** The cluster requires `sudoers` configuration on each cluster node for <sid\>adm. In this example, that's achieved by creating a new file. Use the `visudo` command to edit the `20-saphana` drop-in file as `root`.
481371
482372
```bash
@@ -500,7 +390,7 @@ This important step optimizes the integration with the cluster and improves the
500390
sapcontrol -nr 03 -function StartSystem
501391
```
502392
503-
1. **[1]** Verify the hook installation. Run as <sid\>adm on the active HANA system replication site.
393+
1. **[1]** Verify the SRHanaSR hook installation. Run as <sid\>adm on the active HANA system replication site.
504394
505395
```bash
506396
cdtrace
@@ -514,7 +404,14 @@ This important step optimizes the integration with the cluster and improves the
514404
# 2021-04-12 21:37:04.898680 ha_dr_SAPHanaSR SOK
515405
```
516406
517-
For more information on the implementation of the SAP HANA System Replication hook, see [Enable the SAP HA/DR provider hook](https://access.redhat.com/articles/3004101#enable-srhook).
407+
1. **[1]** Verify the ChkSrv hook installation. Run as <sid\>adm on the active HANA system replication site.
408+
409+
```bash
410+
cdtrace
411+
tail -20 nameserver_chksrv.trc
412+
```
413+
414+
For more information on the implementation of the SAP HANA hooks, see [Enabling the SAP HANA srConnectionChanged() hook](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux_for_sap_solutions/8/html-single/automating_sap_hana_scale-up_system_replication_using_the_rhel_ha_add-on/index#con_enable_hook_automating-sap-hana-scale-up-system-replication) and [Enabling the SAP HANA srServiceStateChanged() hook for hdbindexserver process failure action (optional)](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux_for_sap_solutions/8/html-single/automating_sap_hana_scale-up_system_replication_using_the_rhel_ha_add-on/index#con_enable_hdbindexserver_automating-sap-hana-scale-up-system-replication).
518415
519416
## Create SAP HANA cluster resources
520417

0 commit comments

Comments
 (0)