While in this state, all monitoring for the SAP HANA resource will be suspended until the resource is brought in-service in LifeKeeper on the server that is intended to be the primary replication site.
Changing the Replication Mode
The SAP HANA System Replication mode can be changed by using the “hdbnsutil -sr_changemode” command, even while the database is running on a secondary replication site.
- Execute the following command on a secondary replication site:
su - <sid>adm -c "hdbnsutil -sr_changemode --mode=[sync|syncmem|async]"
sudo -iu <sid>adm hdbnsutil -sr_changemode --mode=[sync|syncmem|async]
where <sid> is the lower-case SAP System ID for the SAP HANA installation and the desired replication mode (sync, syncmem, or async) is provided in the --mode option. The database can be running or stopped on the secondary site when this command is executed.
- To confirm that the replication mode was changed successfully, execute the following command on the secondary replication site:
su - <sid>adm -c "hdbnsutil -sr_state"
sudo -iu <sid>adm hdbnsutil -sr_state
and verify that the “mode” parameter has been updated to the new replication mode.
After the next quickCheck interval (default 2 minutes), LifeKeeper will automatically detect the change and update the info fields for all equivalent SAP HANA resources to contain the new replication mode. This can be verified by inspecting the info field for the HANA resource using the following command:
/opt/LifeKeeper/bin/ins_list -d <HostName> -t <Tag> -f: | cut -d: -f6 | tr '\002' ':'
where <HostName> is the host name of the server to obtain information on and <Tag> is the tag name of the SAP HANA resource in LifeKeeper (e.g., HANA-SPS_HDB00) on the given server.
The currently stored secondary replication mode is the third field in the output of this command:
SPS:HDB00:node2/sync:SiteA:node2/logreplay
In the case of a configuration greater than two nodes, the output will look similar to this:
SPS:HDB00:node2/sync node3/async:SiteA:node2/logreplay node3/logreplay
Changing the Operation Mode
Changing the operation mode in SAP HANA System Replication typically requires stopping the database on associated secondary sites, re-registering it with the new operation mode, and restarting the database on the secondary sites. In order to prevent LifeKeeper from automatically restarting the database on the secondary sites during this process, it is recommended to suspend monitoring for the HANA resource until the database has been successfully re-registered with the new operation mode.
- Suspend monitoring of the HANA resource by creating the corresponding nomonitor flag on the server where the resource is currently Active (ISP):
/opt/LifeKeeper/bin/flg_create -f 'nomonitor_<Tag>'
where <Tag> is the HANA resource tag in LifeKeeper on that server (e.g., HANA-SPS_HDB00). Once finished with this process, it is very important to remember to resume monitoring of the resource by removing the nomonitor flag with the command:
/opt/LifeKeeper/bin/flg_remove -f 'nomonitor_<Tag>'
Warning: Failure to remove this flag after performing the maintenance operations will cause any failures of the SAP HANA database to go undetected by LifeKeeper.
- Ensure that the SAP HANA database is stopped on the backup servers by executing the following command on them:
su - <sid>adm -c "sapcontrol -nr <HDB Inst# > -function StopSystem HDB"
sudo -iu <sid>adm sapcontrol -nr <HDB Inst# > -function StopSystem HDB
where <HDB Inst#> is the instance number for the SAP HANA database instance (e.g., for an instance named HDB00, the instance number is 00).
- Execute the following command on the backup servers with the desired replication and operation modes to re-register them as secondary replication sites:
su - <sid>adm -c "hdbnsutil -sr_register --name=<SecondarySiteName> --remoteHost=<PrimaryHost> --remoteInstance=<PrimaryInst#> --replicationMode=[sync|syncmem|async] --operationMode=[delta_datashipping|logreplay|logreplay_readaccess]"
sudo -iu <sid>adm hdbnsutil -sr_register --name=<SecondarySiteName> --remoteHost=<PrimaryHost> --remoteInstance=<PrimaryInst#> --replicationMode=[sync|syncmem|async] --operationMode=[delta_datashipping|logreplay|logreplay_readaccess]
where <SecondarySiteName> is the alias to be used by SAP HANA System Replication to identify the secondary replication site, <PrimaryHost> is the host name of the server which is currently registered as the primary replication site, and <PrimaryInst#> is the instance number for the HDB instance on the primary replication site. Note: It is not necessary to unregister the secondary sites with the “hdbnsutil -sr_unregister” command before re-registering them with a new replication or operation mode.
- To verify that a backup server was successfully re-registered as a secondary replication site with the new operation mode, execute the following command on the backup server:
su - <sid>adm -c "hdbnsutil -sr_state"
sudo -iu <sid>adm hdbnsutil -sr_state
and verify that “is secondary/consumer system” is true and that the parameter “operation mode” has been updated to the new operation mode.
- Once the backup server has been successfully registered as a secondary replication site, start the database by executing the following command on the backup server:
su - <sid>adm -c "sapcontrol -nr <HDB Inst#> -function StartSystem HDB"
sudo -iu <sid>adm sapcontrol -nr <HDB Inst#> -function StartSystem HDB
where <HDB Inst#> is the instance number for the SAP HANA database instance.
- Once the process is complete, remove the nomonitor flag that was created in Step 1 in order to resume LifeKeeper monitoring of the HANA resource:
where /opt/LifeKeeper/bin/flg_remove -f 'nomonitor_<Tag>'
Warning: Failure to remove this flag will cause any failures of the SAP HANA database to go undetected by LifeKeeper.
After the next quickCheck interval (default 2 minutes), LifeKeeper will automatically detect the change and update the info fields for all equivalent SAP HANA resources to contain the new operation mode. This can be verified by inspecting the info field for the HANA resource using the following command:
/opt/LifeKeeper/bin/ins_list -d <HostName> -t <Tag> -f: | cut -d: -f6 | tr '\002' ':'
ame> is the host name of the server to obtain information on and <Tag> is the tag name of the SAP HANA resource in LifeKeeper (e.g., HANA-SPS_HDB00) on the given server.
The currently stored secondary replication mode is the fifth field in the output of this command:
SPS:HDB00:node2/sync:SiteA:node2/logreplay
In the case of a configuration greater than two nodes, the output will look similar to this:
SPS:HDB00:node2/sync node3/async:SiteA:node2/logreplay node3/logreplay
Post your comment on this topic.