HANA数据 HA集群手工切换方法

在配置了SystemReplication但未配置OSHAE或HAE的情况下,需进入维护模式手动执行HANA数据库的takeover。该过程包括以root用户登录备节点,切换到HANA数据库用户,使用hdbnsutil-srtakeover命令进行切换,并通过hdbnsutil-sr_register注册旧主节点为新备节点。在整个过程中,需确保系统复制处于同步状态并监控数据库状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

HANA手工切换   得进入维护模式执行

如何在备节点手动 takeover 数据库
须知
        手动 takeover 的前提必须是只配置 System Replication,未配置 OS HAE 或 HAE 进入维护模式下执行,否则数据库会出现双主 (primary)的情况,导致 HAE 将数据库强制关闭。 在手动 takeover 数据库前,需要确保数据库同步完成,否则 takeover 失败。


步骤1  

        以 root 用户登录备节点服务器,然后执行 su- s00adm 命令切换到 HANA 数据库的用
s00adm 中的 s00 请使用实际数据库 SID 的小写替换。


步骤 2

        执行 hdbnsutil -sr takeover 命令手动将备节点 takeover 为主节点。


步骤 3

        参考 2.1.4.7 如何查看本机 HANA 数据库是主节点还是备节点,查看数据库状态。
若数据库模式(mode)变为 primary,说明切换完成。

Begin the maintenance

  1. Set the maintenance meta attribute of the multi-state resource for SAP HANA.

    # crm resource maintenance msl_SAPHana_HA1_HDB10 on

  2. Wait, till the cluster is in idle (S_IDLE) state. Remark: cs_wait_for_idle is part of the ClusterTools2 package.

    # cs_wait_for_idle -s 5

    Cluster state: S_IDLE

Do the changes on the SAP workload

  1. Before triggering the takeover, check that the system replication is in sync. Login on the primary.

    # su - ha1adm

    ~> HDBSettings.sh systemReplicationStatus.py --sapcontrol=1 | egrep -i '(site|overall).*replication_status'

    site/2/REPLICATION_STATUS=ACTIVE

    overall_replication_status=ACTIVE

    Check the site and overall replication status. In best both are “ACTIVE”.

  2. It’s time to trigger the takeover in handshake mode. The primary suspends the transaction activity. Primary and secondary still communicate about the system replication status. They check, if the system replication is in sync. This means the last committed transaction is available on the secondary. The takeover is released. The former secondary gets the new primary. The former primary is still up but blocks all transactions. Login on the secondary.

    # su - ha1adm

    ~> hdbnsutil -sr_takeover --suspendPrimary   (可以不加--suspendPrimary参数,有可能会切换不过来,记得先进入维护)模式

  3. Once the takeover is successful, register the old primary to get the new secondary. This blog documents that in the online mode. As an alternative first stop SAP HANA, register offline and start SAP HANA. Make sure to use the same site names as note down before (here WDF). Logon on the ‘old’ primary.

    # su - ha1adm

    ~> hdbnsutil -sr_register \

    --online \

    --name=WDF \

    --remoteHost=suse02 --remoteInstance=10 \

    --replicationMode=sync --operationMode=logreplay

  4. Repeat step 1. Check the replication status on the ‘new’ primary. Before we end the maintenance, the new SAP HANA instance pair should be both up-and-running. The system replication status must be ‘ACTIVE‘. The cluster should show no resource errors.

End the maintenance

  1. Refresh the multi-state resource. The resource agent now detects the new system replication topology and adjusts the promotion scores.

    # crm cluster refresh msl_SAPHana_HA1_HDB10

    # cs_wait_for_idle -s 5

    Cluster state: S_IDLE

  2. End the maintenance. The resource agent sets the e.g. srHook  attribute for the new primary site to ‘PRIM‘.

    # crm resource maintenance msl_SAPHana_HA1_HDB10 off

Finally check the cluster is in normal operation, is in idle state and does not show resource errors.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值