通过


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

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

本文介绍如何在具有备用节点的横向扩展配置方案中使用作为共享存储卷的 Azure NetApp Files 在 Azure 虚拟机上部署高度可用的 SAP HANA 系统。

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

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

  • Azure NetApp Files 文档
  • SAP 说明 1928533 包括:
    • 部署 SAP 软件支持的Azure VM 大小列表
    • Azure VM 大小的重要容量信息
    • 支持的 SAP 软件、操作系统 (OS) 和数据库组合
    • Microsoft Azure上的 Windows 和 Linux 所需的 SAP 内核版本
  • SAP 说明 2015553:列出 Azure 中 SAP 支持的 SAP 软件部署的先决条件
  • SAP 说明 2205917:包含适用于 SUSE Linux Enterprise Server for SAP Applications 的推荐 OS 设置
  • SAP 说明 1944799:包含适用于 SUSE Linux Enterprise Server for SAP Applications 的 SAP 准则
  • SAP 说明 2178632:包含有关 Azure 中针对 SAP 报告的所有监视指标的详细信息
  • SAP 说明 2191498:包含 Azure 中 Linux 所需的 SAP 主机代理版本
  • SAP 说明 2243692:包含有关在 Azure 上的 Linux 中 SAP 许可的信息
  • SAP 说明 1984787:包含有关 SUSE Linux Enterprise Server 12 的一般信息
  • SAP 说明 1999351:包含适用于 SAP 的Azure增强型监视扩展的其他故障排除信息
  • SAP 说明 1900823:包含有关SAP HANA存储要求的信息
  • SAP Community Wiki:包含适用于 Linux 的所有必需 SAP 说明
  • Azure Virtual Machines Linux 上的 SAP 规划和实施
  • 适用于 Linux 上的 SAP 的 Azure Virtual Machines 部署
  • 适用于 Linux 上的 SAP 的 Azure Virtual Machines DBMS 部署
  • SUSE SAP HA 最佳做法指南:包含设置 NetWeaver 高可用性和本地SAP HANA系统复制所需的所有信息(用作常规基线;它们提供更详细的信息)
  • SUSE 高可用性扩展 12 SP3 发行说明
  • 在 Azure NetApp Files 上的 SAP HANA NFS v4.1 卷

概述

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

注意

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

重要说明

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

SAP NetWeaver 高可用性概述

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

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

Azure NetApp 卷位于单独的子网中,传递给 Azure NetApp Files

在此示例配置中,子网为:

  • 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 Files基础结构

在继续设置Azure NetApp Files基础结构之前,请熟悉 Azure NetApp Files 文档

Azure NetApp Files在多个 Azure 区域中可用。 检查所选Azure区域是否提供Azure NetApp Files。

有关Azure区域Azure NetApp Files可用性的信息,请参阅Azure NetApp Files Azure区域的可用性

重要注意事项

当您在 SUSE 高可用性体系结构上为 SAP NetWeaver 创建 Azure NetApp Files 时,请注意“Azure NetApp Files 中的 NFS v4.1 卷对 SAP HANA 的重要注意事项” 文档中记录的重要考虑事项。

在 Azure NetApp Files 上为 HANA 数据库进行大小规划

Azure NetApp Files卷的吞吐量决定于卷大小和服务级别,详见Azure NetApp Files的服务级别

在使用 Azure NetApp Files 设计 Azure 上的 SAP HANA 基础架构时,请注意 Azure NetApp Files 上的 NFS v4.1 卷的建议

本文所述的配置是通过简单的 Azure NetApp Files 卷进行展示的。

重要说明

对于性能是关键的生产系统,我们建议评估和考虑将 Azure NetApp Files 应用程序卷组用于 SAP HANA

部署Azure NetApp Files资源

以下说明假定已部署 Azure 虚拟网络。 Azure NetApp Files 资源和将要装载 Azure NetApp Files 资源的 VM 必须部署在同一 Azure 虚拟网络或对等连接的 Azure 虚拟网络中。

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

  2. 按照设置Azure NetApp Files容量池中的说明来设置Azure NetApp Files容量池。

    本文中介绍的 HANA 体系结构使用 Ultra Service 级别的单个Azure NetApp Files容量池。 对于 Azure 上的 HANA 工作负荷,建议使用 Azure NetApp Files UltraPremiumservice Level

  3. 按照 将子网委托给 Azure NetApp Files 中的说明,将子网委托给 Azure NetApp Files。

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

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

    请记住,Azure NetApp Files资源和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 Files 卷的文件路径。

    • volume HN1-data-mnt00001 (nfs://10.23.1.5/HN1-data-mnt00001
    • volume HN1-data-mnt00002 (nfs://10.23.1.6/ HN1-data-mnt00002
    • volume HN1-log-mnt00001 (nfs://10.23.1.4/HN1-log-mnt00001)
    • volume HN1-log-mnt00002(nfs://10.23.1.6/HN1-log-mnt00002
    • HN1-共享(nfs://10.23.1.4/HN1-共享)

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

通过 Azure 门户部署 Linux 虚拟机

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

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

  2. 部署 VM。

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

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

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

重要说明

对于SAP HANA工作负荷,低延迟至关重要。 若要实现低延迟,请与Microsoft代表协作,确保将虚拟机和Azure NetApp Files卷部署在邻近位置。 在集成新的 SAP HANA 系统时,该系统使用 SAP HANA Azure NetApp Files,请提交必要的信息。

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

重要说明

请确保所选的 OS 经过 SAP 认证,适用于所使用的特定 VM 类型上的SAP HANA。 有关这些类型的SAP HANA认证 VM 类型和 OS 版本列表,请转到SAP HANA认证的 IaaS 平台站点。 单击列出的 VM 类型的详细信息,获取该类型的SAP HANA支持的 OS 版本的完整列表。

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

  2. 执行以下步骤创建三个虚拟机(hanadb1hanadb2hanadb3):

    a。 在 Azure 画廊中使用支持 SAP HANA 的 SLES4SAP 映像。

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

    c. 选择客户端Azure虚拟网络子网。 选择 加速网络

    部署虚拟机时,系统会自动生成网络接口名称。 ** 为了简单起见,我们将把自动生成并附加到客户端 Azure 虚拟网络子网上的网络接口称为 hanadb1-clienthanadb2-clienthanadb3-client

  3. storage虚拟网络子网中的每个虚拟机创建三个网络接口(在本示例中,分别为 hanadb1-storagehanadb2-storagehanadb3-storage)。

  4. hana虚拟网络子网创建三个网络接口(在本示例中为 hanadb1-hanahanadb2-hanahanadb3-hana)。

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

    1. 转到 Azure 门户中的虚拟机。
    2. 在左窗格中,选择Virtual Machines。 筛选虚拟机名称(例如 hanadb1),然后选择虚拟机。
    3. 在“概述”窗格中,选择“停止”以解除分配虚拟机。
    4. 选择“网络”,然后附加网络接口。 在“附加网络接口”下拉列表中,选择已为 storage 子网创建的网络接口。
    5. 选择“保存”
    6. 对剩余虚拟机重复步骤 b 到 e(在本示例中, hanadb2hanadb3)。
    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
      

      注意

      无需在 HANA 节点上安装Azure CLI包,才能运行 az 命令。 可以从已安装 CLI 的任何计算机运行它,也可以使用Azure Cloud Shell。

  7. 执行以下步骤启动虚拟机:

    1. 在左窗格中,选择Virtual Machines。 筛选虚拟机名称(例如 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 Files的通信通过存储网络接口传递。

    以下说明假定存储网络接口为 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
    

    [!TIP] 请避免在 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 Files 卷

  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 共享上为 /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 Files域,即 defaultv4iddomain.com,并将映射设置为 nobody

    重要说明

    请确保在 VM 上的 /etc/idmapd.conf 中设置 NFS 域,以匹配 Azure NetApp Files 上的默认域配置: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”。若要创建 所在的目录结构,请执行 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 Files 卷。

    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 装载选项,如 NFS v4.1 卷 在 Azure NetApp Files for SAP HANA中所述。 检查 Linux 版本上 nconnect 是否由 Azure NetApp Files 支持。

  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
    

安装

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

准备 HANA 安装

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

  2. [1] 验证是否可以通过 SSH 登录到 hanadb2hanadb3,而无需提示输入密码。

    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 安装和更新指南中的说明安装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 ]:按 Enter 接受默认值
      • 对于 root用户密码:输入root用户的密码
      • 对于主机 hanadb2 的角色:输入 1 (对于辅助角色)
      • 对于主机 hanadb2 的主机故障转移组[默认]:请按 Enter 键以接受默认值
      • 对于主机 hanadb2 的 存储分区号 [<<自动>>分配]:按 Enter 接受默认值
      • 对于主机 hanadb2 的 工作组 [default]:按回车键接受默认值
      • 对于主机 hanadb3 选择角色:输入 2(备用)
      • 对于主机 hanadb3 的 主机故障切换组 [默认]:按 Enter 键以接受默认设置
      • 对于主机 hanadb3 的 工作组 [default]:按 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节,并从客户端子网中添加相应的 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 Files存储的SAP HANA,请设置以下SAP HANA参数:

    • max_parallel_io_requests 128
    • async_read_submit on
    • async_write_submit_active on
    • async_write_submit_blocks 所有

    有关详细信息,请参阅 i/O 堆栈配置,了解 SAP HANA

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

    对于 SAP HANA 1.0 系统版本 SPS12 及更早版本,可以在安装过程中设置这些参数,如 SAP 说明 2267798中所述。

  7. Azure NetApp Files使用的存储文件大小限制为 16 TB(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. 若要模拟节点崩溃,请在工作器节点上以 root 身份运行以下命令,在本例中为 hanadb2

      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 |
      

      重要说明

      当节点发生内核崩溃时,请将kernel.panic设置为 20 秒,以避免 SAP HANA 故障转移在所有 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. 在活动主节点上以 hn1adm 身份运行以下命令,在本例中为 hanadb1

      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. 重启 HANA 实例在 hanadb1 上(即在同一台虚拟机上,名称服务器已被终止的地方)。 hanadb1 节点将重新加入环境,并保留其备用角色。

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

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

      # 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
      

      Node 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
      

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

      # 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 | -       |
      

后续步骤