SAP HANA 横向扩展 - SAPHANAon AWS

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

SAP HANA 横向扩展

以下部分是使用适用于 ONTAP 的 AWS FSx 作为主存储解决方案的 SAP HANA 横向扩展的主机设置示例,其中备用节点处于开启状态。您可以使用 SAP HANA 主机自动故障转移(SAP 提供的自动解决方案)从 SAP HANA 主机的故障中恢复。有关更多信息,请参阅 SAP HANA-主机自动故障转移

Linux 内核参数

在所有节点91-NetApp-HANA.conf/etc/sysctl.d目录中使用以下配置创建一个名为的文件。

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

将 NFSv4 的最大会话时段增加到 180。

echo options nfs max_session_slots=180 > /etc/modprobe.d/nfsclient.conf

您必须重启实例才能使内核参数和 NFS 设置生效。

网络文件系统 (NFS)

重要

对于 SAP HANA 横向扩展系统,适用于 ONTAP 的 FSx 仅支持 NFS 版本 4.1。

网络文件系统 (NFS) 版本 4 及更高版本需要用户身份验证。您可以使用轻型目录访问协议 (LDAP) 服务器或本地用户帐户进行身份验证。

如果您使用的是本地用户帐户,则必须在所有 Linux 服务器和 SVM 上将 NFSv4 域设置为相同的值。您可以在 Linux 主机的/etc/idmapd.conf文件中设置域参数 (Domain = <domain name>)。

要识别 SVM 的域设置,请使用以下命令:

nfs show -vserver hana-data -fields v4-id-domain

下面是示例输出:

vserver v4-id-domain --------- ------------ hana-data ec2.internal

创建子目录

装载/hana/shared卷并为每台主机创建sharedusr-sap子目录。以下示例命令适用于 4+1 SAP HANA 横向扩展系统。

mkdir /mnt/tmp mount -t nfs -o sec=sys,vers=4.1 <svm-shared>:/HDB-shared /mnt/tmp cd /mnt/tmp mkdir shared mkdir usr-sap-host1 mkdir usr-sap-host2 mkdir usr-sap-host3 mkdir usr-sap-host4 mkdir usr-sap-host5 cd umount /mnt/tmp

创建挂载点

在横向扩展系统上,在所有从属节点和备用节点上创建以下挂载点。以下示例命令适用于 4+1 SAP HANA 横向扩展系统。

mkdir -p /hana/data/HDB/mnt00001 mkdir -p /hana/log/HDB/mnt00001 mkdir -p /hana/data/HDB/mnt00002 mkdir -p /hana/log/HDB/mnt00002 mkdir -p /hana/data/HDB/mnt00003 mkdir -p /hana/log/HDB/mnt00003 mkdir -p /hana/data/HDB/mnt00004 mkdir -p /hana/log/HDB/mnt00004 mkdir -p /hana/shared mkdir -p /usr/sap/HDB

挂载文件系统

创建的文件系统必须作为 NFS 文件系统安装在 Amazon EC2 上。下表是不同 SAP HANA 文件系统的 NFS 选项推荐示例。

文件系统 NFS 挂载选项
常见 NFS 版本 NFS 传输大小 不连接
SAP HANA 数据 rw、bg、hard、timeo=600、noatime, vers=4,minorversion=1,lock, rsize=262144,wsize=262144, nconnect=4
SAP HANA 日志 rw、bg、hard、timeo=600、noatime, vers=4,minorversion=1,lock, rsize=262144,wsize=262144, nconnect=2
SAP HANA 共享了 rw、bg、hard、timeo=600、noatime, vers=4,minorversion=1,lock, rsize=262144,wsize=262144, nconnect=2
SAP HANA 二进 rw、bg、hard、timeo=600、noatime, vers=4,minorversion=1,lock, rsize=262144,wsize=262144, nconnect=2
  • 只有卸载并重新装载 NFS 文件系统后,对nconnect参数的更改才会生效。

  • 访问适用于 ONTAP 的 FSx 时,客户端系统必须具有唯一的主机名。如果存在同名的系统,则第二个系统可能无法访问适用于 ONTAP 的 FSx。

示例-装载共享卷

所有主机/etc/fstab上添加以下几行,以便在实例重启期间保留已装载的文件系统。然后,您可以运行mount -a来装载 NFS 文件系统。

<svm-data_1>:/HDB_data_mnt00001 /hana/data/HDB/mnt00001 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=4 <svm-log_1>:/HDB_log_mnt00001 /hana/log/HDB/mnt00001 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2 <svm-data_2>:/HDB_data_mnt00002 /hana/data/HDB/mnt00002 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=4 <svm-log_2>:/HDB_log_mnt00002 /hana/log/HDB/mnt00002 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2 <svm-data_3>:/HDB_data_mnt00003 /hana/data/HDB/mnt00003 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=4 <svm-log_3>:/HDB_log_mnt00003 /hana/log/HDB/mnt00003 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2 <svm-data_4>:/HDB_data_mnt00004 /hana/data/HDB/mnt00004 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=4 <svm-log_4>:/HDB_log_mnt00004 /hana/log/HDB/mnt00004 nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2 <svm-shared>:/HDB_shared/shared /hana/shared nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2

示例-装载主机特定的卷

台主机上添加主机特定的行,以便/etc/fstab在实例重启期间保留已装载的文件系统。然后,您可以运行mount -a来装载 NFS 文件系统。

Host
主持人 1 <svm-shared>:/HDB_shared/usr-sap-host1 /usr/sap/HDB nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2
主持人 2 <svm-shared>:/HDB_shared/usr-sap-host2 /usr/sap/HDB nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2
主持人 3 <svm-shared>:/HDB_shared/usr-sap-host3 /usr/sap/HDB nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2
主持人 4 <svm-shared>:/HDB_shared/usr-sap-host4 /usr/sap/HDB nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2
主机 5(备用主机) <svm-shared>:/HDB_shared/usr-sap-host5 /usr/sap/HDB nfs rw,bg,hard,timeo=600,noatime,vers=4,minorversion=1,lock,rsize=262144,wsize=262144,nconnect=2

为目录设置所有权

使用以下命令设置 SAP HANA 数据和日志目录hdbadm的所有权。

sudo chown hdbadm:sapsys /hana/data/HDB sudo chown hdbadm:sapsys /hana/log/HDB

SAP HANA 参数

使用所需配置安装 SAP HANA 系统,然后设置以下参数。有关 SAP HANA 安装的更多信息,请参阅 SAP HANA 服务器安装和更新指南

最佳性能

要获得最佳性能,请在global.ini文件中设置以下参数。

[fileio] max_parallel_io_requests=128 async_read_submit=on async_write_submit_active=on async_write_submit_blocks=all

以下 SQL 命令可用于在SYSTEM级别上设置这些参数。

ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('fileio', 'max_parallel_io_requests') = '128' WITH RECONFIGURE; ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('fileio', 'async_read_submit') = 'on' WITH RECONFIGURE; ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('fileio', 'async_write_submit_active') = 'on' WITH RECONFIGURE; ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('fileio', 'async_write_submit_blocks') = 'all' WITH RECONFIGURE;

NFS 锁定租约

从 SAP HANA 2.0 SPS4 开始,SAP HANA 提供了控制故障转移行为的参数。建议使用这些参数,而不是在SVM级别上设置租用时间。namerserver.ini文件中配置了以下参数。

部分 参数
failover normal_retries 9
distributed_watchdog deactivation_retries 11
distributed_watchdog takeover_retries 9

以下 SQL 命令可用于在SYSTEM级别上设置这些参数。

ALTER SYSTEM ALTER CONFIGURATION ('nameserver.ini', 'SYSTEM') SET ('failover', 'normal_retries') = '9' WITH RECONFIGURE; ALTER SYSTEM ALTER CONFIGURATION ('nameserver.ini', 'SYSTEM') SET ('distributed_watchdog', 'deactivation_retries') = '11' WITH RECONFIGURE; ALTER SYSTEM ALTER CONFIGURATION ('nameserver.ini', 'SYSTEM') SET ('distributed_watchdog', 'takeover_retries') = '9' WITH RECONFIGURE;

数据卷分区

在 SAP HANA 2.0 SPS4 中,额外的数据卷分区允许在单主机或多主机系统中为 SAP HANA 租户数据库的数据量配置两个或多个文件系统卷。数据卷分区使 SAP HANA 能够进行扩展,突破单个卷的大小和性能限制。您可以随时添加其他数据卷分区。有关更多信息,请参阅主机配置

宿主准备

必须创建其他装入点和/etc/fstab条目,并且必须装入新的卷。

  • 创建其他挂载点并分配所需的权限、组和所有权。

    mkdir -p /hana/data2/HDB/mnt00001 chmod -R 777 /hana/data2/HDB/mnt00001
  • 向中添加其他文件系统/etc/fstab

    <data2>:/data2 /hana/data2/HDB/mnt00001 nfs mount options
  • 将权限设置为 777。这是允许 SAP HANA 在后续步骤中添加新数据卷所必需的。在创建数据卷期间,SAP HANA 会自动设置更严格的权限。

启用数据卷分区

要启用数据卷分区,请在SYSTEMDB配置global.ini文件中添加以下条目。

[customizable_functionalities] persistence_datavolume_partition_multipath = true
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('customizable_functionalities', 'PERSISTENCE_DATAVOLUME_PARTITION_MULTIPATH') = 'true' WITH RECONFIGURE;
注意

更新global.ini文件后,必须重新启动数据库。

添加其他数据卷分区

对租户数据库运行以下 SQL 语句,向租户数据库添加额外的数据卷分区。

ALTER SYSTEM ALTER DATAVOLUME ADD PARTITION PATH '/hana/data2/HDB/';

添加数据卷分区很快。新的数据卷分区在创建后为空。随着时间的推移,数据在数据卷之间平均分布。

测试主机 auto 故障转移

我们建议您测试您的 SAP HANA 主机自动故障转移方案。有关更多信息,请参阅 SAP HANA-主机自动故障转移

有些词已被编辑,取而代之的是包容性术语。这些词在您的产品、系统代码或表格中可能有所不同。有关更多详细信息,请参阅 SAP 的包容性语言

下表显示了不同测试场景的预期结果。

场景 预期结果
使用的 SAP HANA 从属节点出现故障 echo b > /proc/sysrq-trigger 从属节点故障转移到备用节点
SAP HANA 协调器节点使用HDB终止功能出现故障 SAP HANA 服务故障转移到备用节点(协调器节点的其他候选节点)
当其他协调器节点充当从属节点时,SAP HANA 协调器节点出现故障 协调器节点故障转移到备用节点,而其他协调器节点则充当从属节点

SAP HANA 从属节点出现故障

在测试之前,请检查景观的状态。

hdbadm@hana:/usr/sap/HDB/HDB00/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 | | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | yes | ok | | | 1 | 1 | default | default | coordinator 1 | coordinator | worker | coordinator | worker | worker | default | default | | hanaw01 | yes | ok | | | 2 | 2 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw02 | yes | ok | | | 3 | 3 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 4 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | yes | ignore | | | 0 | 0 | default | default | coordinator 2 | subordinate | standby | standby | standby | standby | default | - | overall host status: ok

在从属节点上运行以下命令root以模拟节点崩溃。在本例中,从属节点是hanaw01

echo b > /proc/sysrq-trigger
hdbadm@hana:/usr/sap/HDB/HDB00/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 | | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | yes | ok | | | 1 | 1 | default | default | coordinator 1 | coordinator | worker | coordinator | worker | worker | default | default | | hanaw01 | no | info | | | 2 | 0 | default | default | subordinate | subordinate | worker | standby | worker | standby | default | - | | hanaw02 | yes | ok | | | 3 | 3 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 4 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | yes | info | | | 0 | 2 | default | default | coordinator 2 | subordinate | standby | subordinate | standby | worker | default | default | overall host status: info hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support>

SAP HANA 协调器节点故障

在使节点崩溃之前,请检查景观的状态。

hdbadm@hana:/usr/sap/HDB/HDB00/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 | | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | yes | ok | | | 1 | 1 | default | default | coordinator 1 | coordinator | worker | coordinator | worker | worker | default | default | | hanaw01 | yes | ok | | | 2 | 2 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw02 | yes | ok | | | 3 | 3 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 4 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | yes | ignore | | | 0 | 0 | default | default | coordinator 2 | subordinate | standby | standby | standby | standby | default | - | overall host status: ok hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support>

使用以下命令通过中断 SAP HANA 进程来模拟协调器节点上的故障。在本例中,协调器节点是hana

hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support> HDB kill
hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support> python landscapeHostConfiguration.py nameserver hana:30001 not responding. | 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 | | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | no | info | | | 1 | 0 | default | default | coordinator 1 | subordinate | worker | standby | worker | standby | default | - | | hanaw01 | yes | ok | | | 2 | 2 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw02 | yes | ok | | | 3 | 3 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 4 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | yes | info | | | 0 | 1 | default | default | coordinator 2 | coordinator | standby | coordinator | standby | worker | default | default | overall host status: info hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support>

当其他协调器节点充当从属节点时,SAP HANA 协调器节点出现故障

在测试之前,请检查景观的状态。

hdbadm@hana:/usr/sap/HDB/HDB00/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 | | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | yes | ok | | | 1 | 2 | default | default | coordinator 1 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw01 | yes | info | | | 2 | 0 | default | default | subordinate | subordinate | worker | standby | worker | standby | default | - | | hanaw02 | yes | ok | | | 3 | 4 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 3 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | yes | info | | | 0 | 1 | default | default | coordinator 2 | coordinator | standby | coordinator | standby | worker | default | default | overall host status: info hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support>

使用以下命令通过中断 SAP HANA 进程来模拟协调器节点上的故障。在本例中,协调器节点是hana04

hdbadm@hanaw04:/usr/sap/HDB/HDB00> HDB kill
hdbadm@hana:/usr/sap/HDB/HDB00/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 | | ------- | -------- | ------- | ---------------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | starting | warning | | | 1 | 1 | default | default | coordinator 1 | coordinator | worker | coordinator | worker | worker | default | default | | hanaw01 | starting | warning | | | 2 | 2 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw02 | yes | ok | | | 3 | 3 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 4 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | no | warning | failover to hana | | 0 | 0 | default | default | coordinator 2 | subordinate | standby | standby | standby | standby | default | - | overall host status: warning hdbadm@hana:/usr/sap/HDB/HDB00/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 | | ------- | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------- | ------- | ------- | ------- | | hana | yes | ok | | | 1 | 1 | default | default | coordinator 1 | coordinator | worker | coordinator | worker | worker | default | default | | hanaw01 | yes | ok | | | 2 | 2 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw02 | yes | ok | | | 3 | 3 | default | default | subordinate | subordinate | worker | subordinate | worker | worker | default | default | | hanaw03 | yes | ok | | | 4 | 4 | default | default | coordinator 3 | subordinate | worker | subordinate | worker | worker | default | default | | hanaw04 | no | ignore | | | 0 | 0 | default | default | coordinator 2 | subordinate | standby | standby | standby | standby | default | - | overall host status: ok hdbadm@hana:/usr/sap/HDB/HDB00/exe/python_support>