你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

使用 SUSE Linux Enterprise Server 上的 Azure NetApp 文件在 Azure VM 上部署具有备用节点的 SAP HANA 横向扩展系统

本文介绍如何将 Azure NetApp 文件用于共享存储卷,在 Azure 虚拟机 (VM) 上部署具有备用节点的、采用横向扩展配置的高可用性 SAP HANA 系统。

在示例配置和安装命令等中,HANA 实例为 03,HANA 系统 ID 为 HN1 。 这些示例基于 HANA 2.0 SP4 和 SUSE Linux Enterprise Server for SAP 12 SP4。

在开始之前,请参阅以下 SAP 说明和文章:

概述

实现 HANA 高可用性的一种方法是配置主机自动故障转移。 若要配置主机自动故障转移,请将一个或多个虚拟机添加到 HANA 系统,并将其配置为备用节点。 当活动节点发生故障时,备用节点会自动接管。 在使用 Azure 虚拟机提供的配置中,可以使用 Azure NetApp 文件上的 NFS 来实现自动故障转移。

注意

备用节点需要访问所有数据库卷。 HANA 卷必须装载为 NFSv4 卷。 NFSv4 协议中经过改进的基于文件租约的锁定机制用于 I/O 隔离。

重要

若要生成受支持的配置,必须将 HANA 数据卷和日志卷部署为 NFSv4.1 卷,并使用 NFSv4.1 协议装载这些卷。 具有备用节点的 HANA 主机自动故障转移配置不支持 NFSv3。

SAP NetWeaver High Availability overview

在上图中,按照 SAP HANA 网络建议,一个 Azure 虚拟网络中表示了三个子网:

  • 用于客户端通信
  • 用于与存储系统通信
  • 用于内部 HANA 节点间通信

Azure NetApp 卷部署在委派给 Azure NetApp 文件的单独子网中。

对于此示例配置,子网为:

  • client 10.23.0.0/24
  • storage 10.23.2.0/24
  • hana 10.23.3.0/24
  • anf 10.23.1.0/26

设置 Azure NetApp 文件基础结构

在继续设置 Azure NetApp 文件基础结构之前,请先通过 Azure NetApp 文件文档熟悉该基础结构。

Azure NetApp 文件在多个 Azure 区域中可用。 查看所选 Azure 区域是否提供 Azure NetApp 文件。

有关 Azure NetApp 文件在各 Azure 区域的可用性的信息,请参阅按 Azure 区域划分的 Azure NetApp 文件可用性

重要注意事项

在 SU 上为 SAP NetWeaver 创建Azure NetApp 文档标准版高可用性体系结构时,请注意 SAP HANA Azure NetApp 文档上的 NFS v4.1 卷中记录的重要注意事项。

调整 Azure NetApp 文件上的 HANA 数据库的大小

Azure NetApp 文件卷的吞吐量取决于卷大小和服务级别,如 Azure NetApp 文件的服务级别中所述。

使用 Azure NetApp 文档 设计 Azure 上的 SAP HANA 基础结构时,请注意 SAP HANA Azure NetApp 文档上的 NFS v4.1 卷中的建议。

本文中的配置提供了简单的 Azure NetApp 文件卷。

重要

对于性能是关键的生产系统,建议评估和考虑使用针对 SAP HANA 的 Azure NetApp 文件应用程序卷组

部署 Azure NetApp 文件资源

以下说明假定你已部署 Azure 虚拟网络。 Azure NetApp 文件资源和 VM(将装载 Azure NetApp 文件资源)必须部署在同一 Azure 虚拟网络或对等 Azure 虚拟网络中。

  1. 按照创建 NetApp 帐户中的说明,在所选的 Azure 区域中创建一个 NetApp 帐户。

  2. 按照设置 Azure NetApp 文件容量池中的说明,设置 Azure NetApp 文件容量池。

    本文中介绍的 HANA 体系结构使用超高性能服务级别的单个 Azure NetApp 文件容量池。 对于 Azure 上的 HANA 工作负荷,建议使用 Azure NetApp 文件“超高性能”或“高级”服务级别

  3. 按照将子网委派给 Azure NetApp 文件中的说明所述,将子网委派给 Azure NetApp 文件。

  4. 按照为 Azure NetApp 文件创建 NFS 卷中的说明部署 Azure NetApp 文件卷。

    部署卷时,请务必选择“NFSv4.1”版本。 目前,需要将 NFSv4.1 访问权限添加到允许列表。 将卷部署在指定的 Azure NetApp 文件子网中。 将自动分配 Azure NetApp 卷的 IP 地址。

    请记住,Azure NetApp 文件资源和 Azure VM 必须位于同一 Azure 虚拟网络或对等 Azure 虚拟网络中。 例如,HN1-data-mnt00001、HN1-log-mnt00001 等是卷名称,nfs://10.23.1.5/HN1-data-mnt00001、nfs://10.23.1.4/HN1-log-mnt00001 等是 Azure NetApp 文件卷的文件路径 。

    • 卷 HN1-data-mnt00001 (nfs://10.23.1.5/HN1-data-mnt00001)
    • 卷 HN1-data-mnt00002 (nfs://10.23.1.6/HN1-data-mnt00002)
    • 卷 HN1-log-mnt00001 (nfs://10.23.1.4/HN1-log-mnt00001)
    • 卷 HN1-log-mnt00002 (nfs://10.23.1.6/HN1-log-mnt00002)
    • 卷 HN1-shared (nfs://10.23.1.4/HN1-shared)

    在此示例中,我们对每个 HANA 数据卷和日志卷使用了单独的 Azure NetApp 文件卷。 要在较小或非生产系统上采用成本优化程度更高的配置,可将所有数据装入点和所有日志装入点放到一个卷上。

通过 Azure 门户部署 Linux 虚拟机

首先,需要创建 Azure NetApp 文件卷。 然后执行以下步骤:

  1. Azure 虚拟网络中创建 Azure 虚拟网络子网

  2. 部署 VM。

  3. 创建更多网络接口,并将这些网络接口附加到相应的 VM。

    每个虚拟机有三个网络接口,分别对应于三个 Azure 虚拟网络子网(clientstoragehana)。

    有关详细信息,请参阅如何在 Azure 中创建具有多个网络接口卡的 Linux 虚拟机

重要

对于 SAP HANA 工作负载,低延迟至关重要。 若要实现低延迟,请与 Microsoft 代表合作,确保虚拟机和 Azure NetApp 文件卷在邻近位置部署。 加入使用 SAP HANA Azure NetApp 文件的新 SAP HANA 系统时,请提交所需的信息。

接下来的说明假设已创建资源组、Azure 虚拟网络和三个 Azure 虚拟网络子网:clientstoragehana。 部署 VM 时,请选择 client 子网,使客户端网络接口成为 VM 上的主要接口。 此外,还需要配置一个通过 storage 子网网关到达 Azure NetApp 文件委派子网的显式路由。

重要

请确保选择的操作系统已经过 SAP 针对使用的特定 VM 类型上的 SAP HANA 进行的认证。 有关经 SAP HANA 认证的 VM 类型和这些类型的 OS 版本列表,请访问经 SAP HANA 认证的 IaaS 平台网站。 单击进入列出的 VM 类型的详细信息,获取该类型的 SAP HANA 支持的 OS 版本完整列表。

  1. 为 SAP HANA 创建可用性集。 请确保设置最大更新域。

  2. 执行以下步骤创建三个虚拟机(hanadb1、hanadb2、hanadb3) :

    a. 使用 Azure 库中受 SAP HANA 支持的 SLES4SAP 映像。

    b. 选择前面为 SAP HANA 创建的可用性集。

    c. 选择 client Azure 虚拟网络子网。 选择加速网络

    部署虚拟机时,系统会自动生成网络接口名称。 在这些说明中,为方便起见,我们将自动生成的、已附加到 client Azure 虚拟网络子网的网络接口称为 hanadb1-client、hanadb2-client 和 hanadb3-client 。

  3. storage 虚拟网络子网创建三个网络接口(为每个虚拟机各创建一个,在此示例中分别为 hanadb1-storage、hanadb2-storage 和 hanadb3-storage) 。

  4. hana 虚拟网络子网创建三个网络接口(为每个虚拟机各创建一个,在此示例中分别为 hanadb1-hana、hanadb2-hana 和 hanadb3-hana)。

  5. 执行以下步骤,将新建的虚拟网络接口附加到相应的虚拟机:

    1. 转到 Azure 门户中的虚拟机。
    2. 在左侧窗格中,选择“虚拟机”。 按虚拟机名称(例如 hanadb1)进行筛选,然后选择该虚拟机。
    3. 在“概述”窗格中,选择“停止”以解除分配虚拟机。
    4. 选择“网络”,然后附加网络接口。 在“附加网络接口”下拉列表中,选择已为 storagehana 子网创建的网络接口。
    5. 选择“保存”。
    6. 对剩余的虚拟机(在此示例中为 hanadb2 和 hanadb3)重复步骤 b 到 e。
    7. 使虚拟机暂时处于停止状态。 接下来,我们将为所有新附加的网络接口启用加速网络
  6. 通过执行以下步骤,为 storagehana 子网的其他网络接口启用加速网络:

    1. Azure 门户中打开 Azure Cloud Shell

    2. 执行以下命令,为附加到 storagehana 子网的其他网络接口启用加速网络。

      az network nic update --id /subscriptions/your subscription/resourceGroups/your resource group/providers/Microsoft.Network/networkInterfaces/hanadb1-storage --accelerated-networking true
       az network nic update --id /subscriptions/your subscription/resourceGroups/your resource group/providers/Microsoft.Network/networkInterfaces/hanadb2-storage --accelerated-networking true
       az network nic update --id /subscriptions/your subscription/resourceGroups/your resource group/providers/Microsoft.Network/networkInterfaces/hanadb3-storage --accelerated-networking true
      
       az network nic update --id /subscriptions/your subscription/resourceGroups/your resource group/providers/Microsoft.Network/networkInterfaces/hanadb1-hana --accelerated-networking true
       az network nic update --id /subscriptions/your subscription/resourceGroups/your resource group/providers/Microsoft.Network/networkInterfaces/hanadb2-hana --accelerated-networking true
       az network nic update --id /subscriptions/your subscription/resourceGroups/your resource group/providers/Microsoft.Network/networkInterfaces/hanadb3-hana --accelerated-networking true
      
  7. 执行以下步骤启动虚拟机:

    1. 在左侧窗格中,选择“虚拟机”。 按虚拟机名称(例如 hanadb1)进行筛选,然后选择该虚拟机。
    2. 在“概述”窗格中选择“启动” 。

操作系统配置和准备

后续部分中的说明带有以下前缀之一:

  • [A] :适用于所有节点
  • [1] :仅适用于节点 1
  • [2] :仅适用于节点 2
  • [3] :仅适用于节点 3

执行以下步骤配置并准备 OS:

  1. [A] 维护虚拟机上的主机文件。 包括所有子网的条目。 在此示例中,已向 /etc/hosts 中添加了以下条目。

    # Storage
     10.23.2.4   hanadb1-storage
     10.23.2.5   hanadb2-storage
     10.23.2.6   hanadb3-storage
     # Client
     10.23.0.5   hanadb1
     10.23.0.6   hanadb2
     10.23.0.7   hanadb3
     # Hana
     10.23.3.4   hanadb1-hana
     10.23.3.5   hanadb2-hana
     10.23.3.6   hanadb3-hana
    
  2. [A] 更改用于存储的网络接口的 DHCP 和云配置设置,以免发生意外的主机名更改。

    以下说明假设存储网络接口为 eth1

    vi /etc/sysconfig/network/dhcp 
    # Change the following DHCP setting to "no"
    DHCLIENT_SET_HOSTNAME="no"
    
    vi /etc/sysconfig/network/ifcfg-eth1
    # Edit ifcfg-eth1 
    #Change CLOUD_NETCONFIG_MANAGE='yes' to "no"
    CLOUD_NETCONFIG_MANAGE='no'
    
  3. [A] 添加一个网络路由,以便能够通过存储网络接口来与 Azure NetApp 文件通信。

    以下说明假设存储网络接口为 eth1

    vi /etc/sysconfig/network/ifroute-eth1
    
    # Add the following routes 
    # RouterIPforStorageNetwork - - -
    # ANFNetwork/cidr RouterIPforStorageNetwork - -
    10.23.2.1 - - -
    10.23.1.0/26 10.23.2.1 - -
    

    重新启动 VM 以激活更改。

  4. [A] 准备 OS 以在具有 NFS 的 NetApp 系统上运行 SAP HANA,如 SAP 说明 3024346 - 适用于 NetApp NFS 的 Linux 内核设置中所述。 为 NetApp 配置设置创建配置文件 /etc/sysctl.d/91-NetApp-HANA.conf。

    vi /etc/sysctl.d/91-NetApp-HANA.conf
    
    # Add the following entries in the configuration file
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.ipv4.tcp_rmem = 4096 131072 16777216
    net.ipv4.tcp_wmem = 4096 16384 16777216
    net.core.netdev_max_backlog = 300000
    net.ipv4.tcp_slow_start_after_idle=0
    net.ipv4.tcp_no_metrics_save = 1
    net.ipv4.tcp_moderate_rcvbuf = 1
    net.ipv4.tcp_window_scaling = 1
    net.ipv4.tcp_timestamps = 1
    net.ipv4.tcp_sack = 1
    
  5. [A] 在 Microsoft 的配合下为 Azure 配置设置创建配置文件 /etc/sysctl.d/ms-az.conf。

    vi /etc/sysctl.d/ms-az.conf
    
    # Add the following entries in the configuration file
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv4.tcp_max_syn_backlog = 16348
    net.ipv4.conf.all.rp_filter = 0
    sunrpc.tcp_slot_table_entries = 128
    vm.swappiness=10
    

    [!提示] 避免在 sysctl 配置文件中显式设置net.ipv4.ip_local_port_range和net.ipv4.ip_local_reserved_ports,以允许 SAP 主机代理管理端口范围。 有关更多详细信息,请参阅 SAP 说明 2382421

  6. [A] 根据 SAP 说明 3024346 - NetApp NFS 的 Linux 内核设置,调整 NFSv3 卷的 sunrpc 设置。

    vi /etc/modprobe.d/sunrpc.conf
    
    # Insert the following line
    options sunrpc tcp_max_slot_table_entries=128
    

装载 Azure NetApp 文件卷

  1. [A] 为 HANA 数据库卷创建装入点。

    mkdir -p /hana/data/HN1/mnt00001
    mkdir -p /hana/data/HN1/mnt00002
    mkdir -p /hana/log/HN1/mnt00001
    mkdir -p /hana/log/HN1/mnt00002
    mkdir -p /hana/shared
    mkdir -p /usr/sap/HN1
    
  2. [1] 为 HN1-shared 上的 /usr/sap 创建节点特定的目录。

    # Create a temporary directory to mount HN1-shared
    mkdir /mnt/tmp
    
    # if using NFSv3 for this volume, mount with the following command
    mount 10.23.1.4:/HN1-shared /mnt/tmp
    
    # if using NFSv4.1 for this volume, mount with the following command
    mount -t nfs -o sec=sys,nfsvers=4.1 10.23.1.4:/HN1-shared /mnt/tmp
    
    cd /mnt/tmp
    mkdir shared usr-sap-hanadb1 usr-sap-hanadb2 usr-sap-hanadb3
    
    # unmount /hana/shared
    cd
    umount /mnt/tmp
    
  3. [A] 验证 NFS 域设置。 请确保域配置为默认的 Azure NetApp 文件域(即“defaultv4iddomain.com”),并且映射设置为“无人”。

    重要

    确保在 VM 上的 /etc/idmapd.conf 中设置 NFS 域,以匹配 Azure NetApp 文件上的默认域配置:“defaultv4iddomain.com”。 如果 NFS 客户端(即 VM)上的域配置和 NFS 服务器(即 Azure NetApp 配置)之间不匹配,则 VM 上已装载的 Azure NetApp 卷上文件的权限将显示为 nobody

    sudo cat /etc/idmapd.conf
    
    # Example
    [General]
    Verbosity = 0
    Pipefs-Directory = /var/lib/nfs/rpc_pipefs
    Domain = defaultv4iddomain.com
    [Mapping]
    Nobody-User = nobody
    Nobody-Group = nobody
    
  4. [A] 验证 nfs4_disable_idmapping。 它应设置为“Y”。若要创建 nfs4_disable_idmapping 所在的目录结构,请执行 mount 命令。 无法在 /sys/modules 下手动创建目录,因为访问权限是为内核/驱动程序保留的。

    # Check nfs4_disable_idmapping 
    cat /sys/module/nfs/parameters/nfs4_disable_idmapping
    
    # If you need to set nfs4_disable_idmapping to Y
    mkdir /mnt/tmp
    mount 10.23.1.4:/HN1-shared /mnt/tmp
    umount  /mnt/tmp
    echo "Y" > /sys/module/nfs/parameters/nfs4_disable_idmapping
    
    # Make the configuration permanent
    echo "options nfs nfs4_disable_idmapping=Y" >> /etc/modprobe.d/nfs.conf
    
  5. [A] 手动创建 SAP HANA 组和用户。 组 sapsys 和用户 hn1adm 的 ID 必须设置为在加入期间提供的相同 ID。 (在此示例中,ID 设置为“1001”。)如果未正确设置 ID,将无法访问卷。 组 sapsys 以及用户帐户 hn1adm 和 sapadm 的 ID 必须在所有虚拟机上相同。

    # Create user group 
    sudo groupadd -g 1001 sapsys
    
    # Create  users 
    sudo useradd hn1adm -u 1001 -g 1001 -d /usr/sap/HN1/home -c "SAP HANA Database System" -s /bin/sh
    sudo useradd sapadm -u 1002 -g 1001 -d /home/sapadm -c "SAP Local Administrator" -s /bin/sh
    
    # Set the password  for both user ids
    sudo passwd hn1adm
    sudo passwd sapadm
    
  6. [A] 装载共享的 Azure NetApp 文件卷。

    sudo vi /etc/fstab
    
    # Add the following entries
    10.23.1.5:/HN1-data-mnt00001 /hana/data/HN1/mnt00001  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    10.23.1.6:/HN1-data-mnt00002 /hana/data/HN1/mnt00002  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    10.23.1.4:/HN1-log-mnt00001 /hana/log/HN1/mnt00001  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    10.23.1.6:/HN1-log-mnt00002 /hana/log/HN1/mnt00002  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    10.23.1.4:/HN1-shared/shared /hana/shared  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    
    # Mount all volumes
    sudo mount -a
    

    对于需要更高吞吐量的工作负载,请考虑使用 nconnect 装载选项,如适用于 SAP HANA 的 Azure NetApp 文件上的 NFS v4.1 卷中所述。 在你的 Linux 版本中检查 nconnect 是否受 Azure NetApp 文件支持

  7. [1] 在 hanadb1 上装载节点特定的卷。

    sudo vi /etc/fstab
    
    # Add the following entries
    10.23.1.4:/HN1-shared/usr-sap-hanadb1 /usr/sap/HN1  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    
    # Mount the volume
    sudo mount -a
    
  8. [2] 在 hanadb2 上装载节点特定的卷。

    sudo vi /etc/fstab
    
    # Add the following entries
    10.23.1.4:/HN1-shared/usr-sap-hanadb2 /usr/sap/HN1  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    
    # Mount the volume
    sudo mount -a
    
  9. [3] 在 hanadb3 上装载节点特定的卷。

    sudo vi /etc/fstab
    
    # Add the following entries
    10.23.1.4:/HN1-shared/usr-sap-hanadb3 /usr/sap/HN1  nfs   rw,nfsvers=4.1,hard,timeo=600,rsize=262144,wsize=262144,noatime,lock,_netdev,sec=sys  0  0
    
    # Mount the volume
    sudo mount -a
    
  10. [A] 验证是否使用 NFS 协议版本 NFSv4.1 装载了所有 HANA 卷。

    sudo nfsstat -m
    
    # Verify that flag vers is set to 4.1 
    # Example from hanadb1
    /hana/data/HN1/mnt00001 from 10.23.1.5:/HN1-data-mnt00001
     Flags: rw,noatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.23.2.4,local_lock=none,addr=10.23.1.5
    /hana/log/HN1/mnt00002 from 10.23.1.6:/HN1-log-mnt00002
     Flags: rw,noatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.23.2.4,local_lock=none,addr=10.23.1.6
    /hana/data/HN1/mnt00002 from 10.23.1.6:/HN1-data-mnt00002
     Flags: rw,noatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.23.2.4,local_lock=none,addr=10.23.1.6
    /hana/log/HN1/mnt00001 from 10.23.1.4:/HN1-log-mnt00001
    Flags: rw,noatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.23.2.4,local_lock=none,addr=10.23.1.4
    /usr/sap/HN1 from 10.23.1.4:/HN1-shared/usr-sap-hanadb1
     Flags: rw,noatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.23.2.4,local_lock=none,addr=10.23.1.4
    /hana/shared from 10.23.1.4:/HN1-shared/shared
     Flags: rw,noatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.23.2.4,local_lock=none,addr=10.23.1.4
    

安装

在此示例中,我们已使用 HANA 2.0 SP4 在 Azure 中部署了具有备用节点、采用横向扩展配置的 SAP HANA。

准备 HANA 安装

  1. [A] 在安装 HANA 之前,请设置根密码。 可以在安装完成后禁用根密码。 以 root 身份执行命令 passwd

  2. [1] 确保可以通过 SSH 登录到 hanadb2 和 hanadb3,并且登录过程中不会提示输入密码 。

    ssh root@hanadb2
    ssh root@hanadb3
    
  3. [A] 安装 HANA 2.0 SP4 所需的其他包。 有关详细信息,请参阅 SAP 说明 2593824

    sudo zypper install libgcc_s1 libstdc++6 libatomic1
    
  4. [2]、[3] 将 SAP HANA datalog 目录的所有权更改为 hn1adm 。

    # Execute as root
    sudo chown hn1adm:sapsys /hana/data/HN1
    sudo chown hn1adm:sapsys /hana/log/HN1
    

HANA 安装

  1. [1] 按照 SAP HANA 2.0 Installation and Update guide(SAP HANA 2.0 安装和更新指南)中的说明安装 SAP HANA。 在此示例中,我们将安装包含主节点、一个工作器节点和一个备用节点的 SAP HANA 横向扩展系统。

    1. 从 HANA 安装软件目录启动 hdblcm 程序。 使用 internal_network 参数并传递子网的地址空间,用于内部 HANA 节点间通信。

      ./hdblcm --internal_network=10.23.3.0/24
      
    2. 在提示符处输入以下值:

      • 对于“选择操作”:输入 1(用于安装)
      • 对于“要安装的其他组件”:输入 2、3
      • 对于安装路径:按 Enter(默认为 /hana/shared)
      • 对于“本地主机名”:按 Enter 接受默认值
      • 在“是否要将主机添加到系统?”下:输入 y
      • 对于“要添加的逗号分隔主机名”:输入 hanadb2, hanadb3
      • 对于“Root 用户名 [root]”:按 Enter 接受默认值
      • 对于“Root 用户密码”:输入 root 用户的密码
      • 对于主机 hanadb2 的角色:输入 1(表示辅助角色)
      • 对于主机 hanadb2 的“主机故障转移组”[默认值]:按 Enter 接受默认值
      • 对于“主机 hanadb2 的存储分区号 [<<自动分配>>]”:按 Enter 接受默认值
      • 对于主机 hanadb2 的“辅助角色组”[默认值]:按 Enter 接受默认值
      • 对于主机 hanadb3 的“选择角色”:输入 2(表示备用角色)
      • 对于主机 hanadb3 的“主机故障转移组”[默认值]:按 Enter 接受默认值
      • 对于主机 hanadb3 的“辅助角色组”[默认值]:按 Enter 接受默认值
      • 对于“SAP HANA 系统 ID”:输入 HN1
      • 对于“实例号”[00]:输入 03
      • 对于“本地主机辅助角色组”[默认值]:按 Enter 接受默认值
      • 对于“选择系统使用情况/输入索引[4]”:输入 4(用于自定义)
      • 对于“数据卷的位置”[/hana/data/HN1]:按 Enter 接受默认值
      • 对于“日志卷的位置”[/hana/log/HN1]:按 Enter 接受默认值
      • 对于“是否限制最大内存分配?”[n]:输入 n
      • 对于“主机 hanadb1 的证书主机名”[hanadb1]:按 Enter 接受默认值
      • 对于“主机 hanadb2 的证书主机名”[hanadb2]:按 Enter 接受默认值
      • 对于“主机 hanadb3 的证书主机名”[hanadb3]:按 Enter 接受默认值
      • 对于“系统管理员(hn1adm)密码”:输入密码
      • 对于“系统数据库用户(system)密码”:输入系统的密码
      • 对于“确认系统数据库用户(system)密码”:输入系统的密码
      • 对于“重新引导计算机后是否重启系统?”[n]:输入 n
      • 对于“是否要继续 (y/n)”:验证摘要,如果一切正常,请输入 y
  2. [1] 验证 global.ini。

    显示 global.ini,并确保 SAP HANA 内部节点间通信的配置已就位。 验证 communication 节。 它应该具有 hana 子网的地址空间,并且 listeninterface 应设置为 .internal。 验证 internal_hostname_resolution 节。 它应该具有属于 hana 子网的 HANA 虚拟机的 IP 地址。

    sudo cat /usr/sap/HN1/SYS/global/hdb/custom/config/global.ini
    
    # Example 
    #global.ini last modified 2019-09-10 00:12:45.192808 by hdbnameserve
    [communication]
    internal_network = 10.23.3/24
    listeninterface = .internal
    [internal_hostname_resolution]
    10.23.3.4 = hanadb1
    10.23.3.5 = hanadb2
    10.23.3.6 = hanadb3
    
  3. [1] 添加主机映射,以确保使用客户端 IP 地址进行客户端通信。 添加 public_host_resolution 节,并添加 client 子网中的相应 IP 地址。

    sudo vi /usr/sap/HN1/SYS/global/hdb/custom/config/global.ini
    
    #Add the section
    [public_hostname_resolution]
    map_hanadb1 = 10.23.0.5
    map_hanadb2 = 10.23.0.6
    map_hanadb3 = 10.23.0.7
    
  4. [1] 重启 SAP HANA 以激活更改。

    sudo -u hn1adm /usr/sap/hostctrl/exe/sapcontrol -nr 03 -function StopSystem HDB
    sudo -u hn1adm /usr/sap/hostctrl/exe/sapcontrol -nr 03 -function StartSystem HDB
    
  5. [1] 验证客户端接口是否使用 client 子网中的 IP 地址进行通信。

    sudo -u hn1adm /usr/sap/HN1/HDB03/exe/hdbsql -u SYSTEM -p "password" -i 03 -d SYSTEMDB 'select * from SYS.M_HOST_INFORMATION'|grep net_publicname
    
    # Expected result
    "hanadb3","net_publicname","10.23.0.7"
    "hanadb2","net_publicname","10.23.0.6"
    "hanadb1","net_publicname","10.23.0.5"
    

    有关如何验证配置的信息,请参阅 SAP 说明 2183363 - SAP HANA 内部网络的配置

  6. 若要为基础 Azure NetApp 文件存储优化 SAP HANA,请设置以下 SAP HANA 参数:

    • max_parallel_io_requests128
    • async_read_submiton
    • async_write_submit_activeon
    • async_write_submit_blocksall

    有关详细信息,请参阅 SAP HANA 的 I/O 堆栈配置

    从 SAP HANA 2.0 系统开始,可以在 global.ini 中设置参数。 有关详细信息,请参阅 SAP 说明 1999930

    对于 SAP HANA 1.0 系统版本 SPS12 和更低版本,可以按照 SAP 说明 2267798 中所述,在安装期间设置这些参数。

  7. Azure NetApp 文件所用存储的文件大小限制为 16 TB。 SAP HANA 对存储限制没有内隐意识,达到 16 TB 的文件大小限制时,它不会自动创建新的数据文件。 随着 SAP HANA 不断尝试将文件增大至 16 TB 以上,这种尝试将导致出错,并最终导致索引服务器故障。

    重要

    为了防止 SAP HANA 尝试将数据文件增大至超过存储子系统的 16-TB 限制,请在 global.ini 中设置以下参数。

    • datavolume_striping = true
    • datavolume_striping_size_gb = 15000。有关详细信息,请参阅 SAP 说明 2400005。 请留意 SAP 说明 2631285

测试 SAP HANA 故障转移

注意

本文包含对 Microsoft 不再使用的术语的引用。 从软件中删除这些术语后,我们会将其从本文中删除。

  1. 模拟 SAP HANA 工作器节点上的节点崩溃。 请执行以下操作:

    1. 在模拟节点故障之前,请以 hn1adm 身份运行以下命令,以捕获环境的状态:

      # Check the landscape status
      python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker  | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | yes    | ok     |          |        |         1 |         1 | default  | default  | master 1   | master     | worker      | master      | worker  | worker  | default | default |
      | hanadb2 | yes    | ok     |          |        |         2 |         2 | default  | default  | master 2   | slave      | worker      | slave       | worker  | worker  | default | default |
      | hanadb3 | yes    | ignore |          |        |         0 |         0 | default  | default  | master 3   | slave      | standby     | standby     | standby | standby | default | -       |
      
      # Check the instance status
      sapcontrol -nr 03  -function GetSystemInstanceList
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
      
    2. 若要模拟节点故障,请在工作器节点(在本例中为 hanadb2)上以 root 身份运行以下命令:

      echo b > /proc/sysrq-trigger
      
    3. 监视系统的故障转移完成状态。 故障转移完成后,请捕获状态。状态应如下所示:

      # Check the instance status
      sapcontrol -nr 03  -function GetSystemInstanceList
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GRAY
      
      # Check the landscape status
      /usr/sap/HN1/HDB03/exe/python_support> python landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker  | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | yes    | ok     |          |        |         1 |         1 | default  | default  | master 1   | master     | worker      | master      | worker  | worker  | default | default |
      | hanadb2 | no     | info   |          |        |         2 |         0 | default  | default  | master 2   | slave      | worker      | standby     | worker  | standby | default | -       |
      | hanadb3 | yes    | info   |          |        |         0 |         2 | default  | default  | master 3   | slave      | standby     | slave       | standby | worker  | default | default |
      

      重要

      如果节点遇到内核 panic,请在所有 HANA 虚拟机上将 kernel.panic 设置为 20 秒,以避免 SAP HANA 故障转移出现延迟。 在 /etc/sysctl 中完成配置。 重新引导虚拟机以激活更改。 如果不执行此更改,当某个节点遇到内核 panic 时,故障转移可能需要 10 分钟或更长时间。

  2. 通过执行以下操作来终止名称服务器:

    1. 在测试之前,以 hn1adm 身份运行以下命令,以检查环境的状态:

      #Landscape status 
      python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | yes    | ok     |          |        |         1 |         1 | default  | default  | master 1   | master     | worker      | master      | worker  | worker  | default | default |
      | hanadb2 | yes    | ok     |          |        |         2 |         2 | default  | default  | master 2   | slave      | worker      | slave       | worker  | worker  | default | default |
      | hanadb3 | no     | ignore |          |        |         0 |         0 | default  | default  | master 3   | slave      | standby     | standby     | standby | standby | default | -       |
      
      # Check the instance status
      sapcontrol -nr 03  -function GetSystemInstanceList
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GRAY
      
    2. 在活动主节点(在本例中为 hanadb1)上以 hn1adm 身份运行以下命令 :

      hn1adm@hanadb1:/usr/sap/HN1/HDB03> HDB kill
      

      备用节点 hanadb3 将接管为主节点。 下面是完成故障转移测试后的资源状态:

      # Check the instance status
      sapcontrol -nr 03 -function GetSystemInstanceList
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GRAY
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
      
      # Check the landscape status
      python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker  | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | no     | info   |          |        |         1 |         0 | default  | default  | master 1   | slave      | worker      | standby     | worker  | standby | default | -       |
      | hanadb2 | yes    | ok     |          |        |         2 |         2 | default  | default  | master 2   | slave      | worker      | slave       | worker  | worker  | default | default |
      | hanadb3 | yes    | info   |          |        |         0 |         1 | default  | default  | master 3   | master     | standby     | master      | standby | worker  | default | default |
      
    3. 在 hanadb1 上(即,在其名称服务器已终止的同一个虚拟机上)重启 HANA 实例。 hanadb1 节点将重新加入环境,并保留其备用角色。

      hn1adm@hanadb1:/usr/sap/HN1/HDB03> HDB start
      

      在 hanadb1 上启动 SAP HANA 后,预期会显示以下状态:

      # Check the instance status
      sapcontrol -nr 03 -function GetSystemInstanceList
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
      # Check the landscape status
      python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker  | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | yes    | info   |          |        |         1 |         0 | default  | default  | master 1   | slave      | worker      | standby     | worker  | standby | default | -       |
      | hanadb2 | yes    | ok     |          |        |         2 |         2 | default  | default  | master 2   | slave      | worker      | slave       | worker  | worker  | default | default |
      | hanadb3 | yes    | info   |          |        |         0 |         1 | default  | default  | master 3   | master     | standby     | master      | standby | worker  | default | default |
      
    4. 同样,在当前处于活动状态的主节点上(即,在节点 hanadb3 上)终止名称服务器。

      hn1adm@hanadb3:/usr/sap/HN1/HDB03> HDB kill
      

      节点 hanadb1 将恢复主节点角色。 故障转移测试完成后,状态将如下所示:

      # Check the instance status
      sapcontrol -nr 03  -function GetSystemInstanceList & python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GRAY
      
      # Check the landscape status
      python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker  | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | yes    | ok     |          |        |         1 |         1 | default  | default  | master 1   | master     | worker      | master      | worker  | worker  | default | default |
      | hanadb2 | yes    | ok     |          |        |         2 |         2 | default  | default  | master 2   | slave      | worker      | slave       | worker  | worker  | default | default |
      | hanadb3 | no     | ignore |          |        |         0 |         0 | default  | default  | master 3   | slave      | standby     | standby     | standby | standby | default | -       |
      
    5. 在已准备好充当备用节点的 hanadb3 上启动 SAP HANA。

      hn1adm@hanadb3:/usr/sap/HN1/HDB03> HDB start
      

      在 hanadb3 上启动 SAP HANA 后,状态将如下所示:

      # Check the instance status
      sapcontrol -nr 03  -function GetSystemInstanceList & python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      GetSystemInstanceList
      OK
      hostname, instanceNr, httpPort, httpsPort, startPriority, features, dispstatus
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GRAY
      # Check the landscape status
      python /usr/sap/HN1/HDB03/exe/python_support/landscapeHostConfiguration.py
      | Host    | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host    | Host    | Worker  | Worker  |
      |         | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config  | Actual  | Config  | Actual  |
      |         |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles   | Roles   | Groups  | Groups  |
      | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- |
      | hanadb1 | yes    | ok     |          |        |         1 |         1 | default  | default  | master 1   | master     | worker      | master      | worker  | worker  | default | default |
      | hanadb2 | yes    | ok     |          |        |         2 |         2 | default  | default  | master 2   | slave      | worker      | slave       | worker  | worker  | default | default |
      | hanadb3 | no     | ignore |          |        |         0 |         0 | default  | default  | master 3   | slave      | standby     | standby     | standby | standby | default | -       |
      

后续步骤