共用方式為


在 Red Hat Enterprise Linux 上使用 Azure NetApp Files 於 Azure VM 上部署 SAP HANA 擴增系統與待命節點

本文說明如何使用作為共用儲存體磁碟區的 Azure NetApp Files,透過 Azure Red Hat Enterprise Linux 虛擬機器 (VM) 上的待命節點,部署採用擴增設定的高可用性 SAP HANA 系統。

在組態、安裝命令等範例中,HANA 執行個體為 03,而 HANA 系統識別碼為 HN1。 這些範例是以適用於 SAP 7.6 的 HANA 2.0 SP4 和 Red Hat Enterprise Linux 為基礎。

注意

本文參考了 Microsoft 不再使用的詞彙。 當這些字詞在軟體中移除時,也會在本文中移除。

開始之前,請先參閱下列 SAP 附註和文件:

概觀

達成 HANA 高可用性的其中一種方法是設定主機自動容錯移轉。 若要設定主機自動容錯移轉,您可以將一或多部虛擬機器新增至 HANA 系統,並將其設定為待命節點。 當作用中的節點失敗時,待命節點會自動接管。 在以下所介紹的 Azure 虛擬機器設定中,您可以使用 Azure NetApp Files 上的 NFS (部分機器翻譯) 來達成自動容錯移轉。

注意

待命節點需要能存取所有的資料庫磁碟區。 HANA 磁碟區必須掛接為 NFSv4 磁碟區。 NFSv4 通訊協定中已改進的檔案租用型鎖定機制會用於 I/O 隔離。

重要

若要建置支援的設定,您必須將 HANA 資料和記錄磁碟區部署為 NFSv4.1 磁碟區,並使用 NFSv4.1 通訊協定來掛接磁碟區。 NFSv3 不支援具有待命節點的 HANA 主機自動容錯移轉設定。

SAP NetWeaver 高可用性概觀

上圖遵循 SAP HANA 網路建議,在一個 Azure 虛擬網路中表示三個子網路:

  • 用戶端通訊
  • 與儲存體系統的通訊
  • 內部 HANA 節點間的通訊

Azure NetApp 磁碟區位在委派給 Azure NetApp Files 的不同子網路中。

在此範例設定中,子網路為:

  • client 10.9.1.0/26
  • storage 10.9.3.0/26
  • hana 10.9.2.0/26
  • anf 10.9.0.0/26 (委派給 Azure NetApp Files 的子網路)

設定 Azure NetApp Files 基礎結構

在繼續設定 Azure NetApp 檔案基礎結構之前,請先熟悉 Azure NetApp Files 文件

Azure NetApp Files 在數個 Azure 區域中提供使用。 檢查選取的 Azure 區域是否提供 Azure NetApp Files。

如需各 Azure 區域的 Azure NetApp Files 可用性資訊,請參閱依據 Azure 區域顯示 Azure NetApp Files 的可用性

重要考量

當您經由待命節點案例建立適用於 SAP HANA 擴充的 Azure NetApp Files 磁碟區時,請注意 SAP HANA 的 Azure NetApp Files 上 NFS v4.1 磁碟區中所述的重要考慮。

針對 Azure NetApp Files 上的 HANA 資料庫進行大小調整

Azure NetApp Files 的輸送量取決於磁碟區大小和服務等級,如 Azure NetApp Files 的服務等級 (部分機器翻譯) 中所述。

當您正在使用 Azure NetApp Files 在 Azure 上設計 SAP Hana 的基礎結構時,請注意適用於 SAP Hana 的 Azure NetApp Files NFS v4.1 磁碟區中的建議。
本文中的設定會顯示簡單的 Azure NetApp Files 磁碟區。

重要

對於效能關鍵的生產系統,建議您評估並考慮使用適用於 SAP HANA 的 Azure NetApp Files 應用程式磁碟區群組

部署 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 服務」層級上使用單一 Azure NetApp Files 容量集區。 針對 Azure 上的 HANA 工作負載,我們建議使用 Azure NetApp Files UltraPremium 服務等級

  3. 遵循將子網路委派給 Azure NetApp Files 中的指示,將子網路委派給 Azure NetApp Files。

  4. 請遵循建立適用於 Azure NetApp Files 的 NFS 磁碟區中的指示,部署 Azure NetApp Files 磁碟區。

    部署磁碟區時,請務必選取 NFSv4.1 版本。 在指定的 Azure NetApp Files 子網路中部署磁碟區。 Azure NetApp 磁碟區的 IP 位址會自動指派。

    請記得,Azure NetApp Files 資源和 Azure VM 必須位於相同的 Azure 虛擬網路,或位於對等互連 Azure 虛擬網路中。 例如,HN1-data-mnt00001、HN1-log-mnt00001 等是磁碟區名稱,而 nfs://10.9.0.4/HN1-data-mnt00001、nfs://10.9.0.4/HN1-log-mnt00001 等是 Azure NetApp Files 磁碟區的檔案路徑。

    • 磁碟區 HN1-data-mnt00001 (nfs://10.9.0.4/HN1-data-mnt00001)
    • 磁碟區 HN1-data-mnt00002 (nfs://10.9.0.4/HN1-data-mnt00002)
    • 磁碟區 HN1-log-mnt00001 (nfs://10.9.0.4/HN1-log-mnt00001)
    • 磁碟區 HN1-log-mnt00002 (nfs://10.9.0.4/ HN1-log-mnt00002)
    • 磁碟區 HN1-shared (nfs://10.9.0.4/HN1-shared)

    在此範例中,我們已針對每個 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 時,請選取用戶端子網路,讓用戶端網路介面成為 VM 上的主要介面。 您也必須透過儲存體子網路閘道,為 Azure NetApp Files 委派的子網路設定明確的路由。

重要

請確定您選取的作業系統在您所使用的特定 VM 類型上已獲得 SAP HANA 認證。 如需這些類型的 SAP Hana 認證的 VM 類型和作業系統版本清單,請移至 SAP Hana 認證的 IaaS 平台網站。 按一下列出的 VM 類型詳細資料,以取得該類型的 SAP HANA 支援作業系統版本完整清單。

  1. 建立 SAP HANA 的可用性設定組。 請務必設定最大的更新網域。

  2. 執行下列步驟,建立三個虛擬機器 (hanadb1hanadb2hanadb3):

    a. 使用 Azure 資源庫中 SAP HANA 支援的 Red Hat Enterprise Linux 映像。 在此範例中,我們使用 RHEL-SAP-HA 7.6 映像。

    b. 選取您稍早為 SAP HANA 建立的可用性設定組。

    c. 選取用戶端 Azure 虛擬網路子網路。 選取 [加速網路] (部分機器翻譯)。

    部署虛擬機器時會自動產生網路介面名稱。 為了簡單起見,在這些指示中我們將參考自動產生的網路介面,這些介面會連結至用戶端 Azure 虛擬網路子網路,例如 hanadb1-clienthanadb2-clienthanadb3-client

  3. storage 虛擬網路子網路建立三個網路介面 (每個虛擬機器各一個),在此範例中為 hanadb1-storagehanadb2-storagehanadb3-storage

  4. hana 虛擬網路子網路建立三個網路介面 (每個虛擬機器各一個),在此範例中為 hanadb1-hanahanadb2-hanahanadb3-hana

  5. 藉由執行下列步驟,將新建立的虛擬網路介面連結至對應的虛擬機器:

    a. 前往 Azure 入口網站中的虛擬機器。

    b. 在左窗格中,選取 [虛擬機器]。 篩選虛擬機器名稱 (例如 hanadb1),然後選取虛擬機器。

    c. 在 [概觀] 窗格中,選取 [停止] 以將虛擬機器解除配置。

    d. 選取 [網路],然後連結網路介面。 在 [連結網路介面] 下拉式清單中,選取已建立的 storagehana 子網路網路介面。

    e. 選取 [儲存]。

    f. 針對其餘虛擬機器 (我們範例中的 hanadb2hanadb3),重複步驟 b 到 e。

    .g 讓虛擬機器目前處於停止狀態。 接下來,我們將為所有新連結的網路介面啟用加速網路

  6. 執行下列步驟,為 storagehana 子網路的其他網路介面啟用加速網路:

    a. 在 Azure 入口網站中開啟 Azure Cloud Shell

    b. 執行下列命令,為附加至 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. 執行下列步驟來啟動虛擬機器:

    a. 在左窗格中,選取 [虛擬機器]。 篩選虛擬機器名稱 (例如 hanadb1),然後將其選取。

    b. 在 [概觀] 窗格中,選取 [啟動]

作業系統設定和準備

在下一節中的指示,前面會加上下列其中一項:

  • [A]:適用於所有節點
  • [1]:僅適用於節點 1
  • [2]:僅適用於節點 2
  • [3]:僅適用於節點 3

執行下列步驟來設定和準備您的作業系統:

  1. [A] 維護虛擬機器上的主機檔案。 包括所有子網路的項目。 在此範例中,下列項目會新增至 /etc/hosts

    
     # Storage
     10.9.3.4   hanadb1-storage
     10.9.3.5   hanadb2-storage
     10.9.3.6   hanadb3-storage
     # Client
     10.9.1.5   hanadb1
     10.9.1.6   hanadb2
     10.9.1.7   hanadb3
     # Hana
     10.9.2.4   hanadb1-hana
     10.9.2.5   hanadb2-hana
     10.9.2.6   hanadb3-hana
     
  2. [A] 新增網路路由,讓 Azure NetApp Files 的通訊通過儲存體網路介面。

    在此範例中,將使用 Networkmanager 來設定其他網路路由。 下列指示會假設儲存體網路介面為 eth1
    首先,判斷 eth1 裝置的連線名稱。 在此範例中,eth1 裝置的連線名稱為 Wired connection 1

    
     # Execute as root
     nmcli connection
     # Result
     #NAME                UUID                                  TYPE      DEVICE
     #System eth0         5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  eth0
     #Wired connection 1  4b0789d1-6146-32eb-83a1-94d61f8d60a7  ethernet  eth1
     

    然後,透過 eth1 設定 Azure NetApp Files 委派網路的其他路由。

    
     # Add the following route 
     # ANFDelegatedSubnet/cidr via StorageSubnetGW dev StorageNetworkInterfaceDevice
     nmcli connection modify "Wired connection 1" +ipv4.routes "10.9.0.0/26 10.9.3.1"
     

    重新啟動 VM 以啟用變更。

  3. [A] 安裝 NFS 用戶端套件。

    
     yum install nfs-utils
     
  4. [A] 請準備好 OS,以便在 Azure NetApp 上使用 NFS 執行 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] 使用其他最佳化設定建立 /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

  1. [A] 調整 sunrpc 設定,如 SAP 附註 3024346 - 適用於 NetApp NFS 的 Linux 核心設定中所建議。

    
     vi /etc/modprobe.d/sunrpc.conf
     # Insert the following line
     options sunrpc tcp_max_slot_table_entries=128
     
  2. [A] Red Hat for HANA 設定。

    按照 SAP 附註 229269024555822593824 和 Red Hat 附註 2447641 中的描述來設定 RHEL。

    注意

    如果安裝 HANA 2.0 SP04,您必須安裝 compat-sap-c++-7 套件,如 SAP 附註 2593824 所述,才能安裝 SAP HANA。

掛接 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-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.9.0.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.9.0.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]
     Domain = defaultv4iddomain.com
     [Mapping]
     Nobody-User = nobody
     Nobody-Group = nobody
     
  4. [A] 驗證 nfs4_disable_idmapping。 其應設為 Y。若要建立 nfs4_disable_idmapping 所在的目錄結構,請執行掛接命令。 您將無法手動在 /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.9.0.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
     

    如需如何變更 nfs4_disable_idmapping 參數的詳細資訊,請參閱 https://access.redhat.com/solutions/1749883

  5. [A] 掛接共用 Azure NetApp Files 磁碟區。

    
     sudo vi /etc/fstab
     # Add the following entries
     10.9.0.4:/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.9.0.4:/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.9.0.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.9.0.4:/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.9.0.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 掛接選項,如 Azure NetApp Files for SAP HANA 上的 NFS v4.1 磁碟區中所述。 檢查 Linux 版本上的 Azure NetApp 檔案是否支援 nconnect

  6. [1]hanadb1 上掛接節點專屬磁碟區。

    
     sudo vi /etc/fstab
     # Add the following entries
     10.9.0.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 
     
  7. [2]hanadb2 上掛接節點專屬磁碟區。

    
     sudo vi /etc/fstab
     # Add the following entries
     10.9.0.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 
     
  8. [3]hanadb3 上掛接節點專屬磁碟區。

    
     sudo vi /etc/fstab
     # Add the following entries
     10.9.0.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 
     
  9. [A] 確認所有 HANA 磁碟區都以 NFS 通訊協定版本 NFSv4 掛接。

    
    sudo nfsstat -m
    # Verify that flag vers is set to 4.1 
    # Example from hanadb1
    /hana/data/HN1/mnt00001 from 10.9.0.4:/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.9.3.4,local_lock=none,addr=10.9.0.4
    /hana/log/HN1/mnt00002 from 10.9.0.4:/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.9.3.4,local_lock=none,addr=10.9.0.4
    /hana/data/HN1/mnt00002 from 10.9.0.4:/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.9.3.4,local_lock=none,addr=10.9.0.4
    /hana/log/HN1/mnt00001 from 10.9.0.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.9.3.4,local_lock=none,addr=10.9.0.4
    /usr/sap/HN1 from 10.9.0.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.9.3.4,local_lock=none,addr=10.9.0.4
    /hana/shared from 10.9.0.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.9.3.4,local_lock=none,addr=10.9.0.4
    

安裝

在此範例中,我們使用 HANA 2.0 SP4,以 Azure 的待命節點在擴增設定中部署 SAP HANA。

準備安裝 HANA

  1. [A] 在 HANA 安裝之前,請設定根密碼。 安裝完成後,您可停用根密碼。 以 root 身分執行 passwd 命令。

  2. [1] 確認您可以透過 SSH 登入 hanadb2hanadb3,不會收到密碼輸入提示。

    
     ssh root@hanadb2
     ssh root@hanadb3
     
  3. [A] 安裝 HANA 2.0 SP4 所需的其他套件。 如需詳細資訊,請參閱 SAP 附註 2593824

    
     yum install libgcc_s1 libstdc++6 compat-sap-c++-7 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
     
  5. [A] 暫時停用防火牆,使其不會干擾 HANA 安裝。 完成 HANA 安裝之後,您可以重新將其啟用。

    
     # Execute as root
     systemctl stop firewalld
     systemctl disable firewalld
    

HANA 安裝

  1. [1]SAP Hana 2.0 安裝和更新指南中的指示,安裝 SAP HANA。 在此範例中,我們會以主要節點、一個背景工作角色和一個待命節點來安裝 SAP HANA 擴增。

    a. 從 HANA 安裝軟體目錄啟動 hdblcm 程式。 使用 internal_network 參數並傳遞子網路的位址空間,用於內部 HANA 節點間的通訊。

    
     ./hdblcm --internal_network=10.9.2.0/26
     

    b. 在提示上輸入下列值:

    • 針對選擇動作:輸入 1 (以進行安裝)
    • 針對要安裝的其他元件:輸入 2, 3
    • 針對安裝路徑:按下 Enter 鍵 (預設為 /hana/shared)
    • 針對 [本機主機名稱]:按下 Enter 鍵以接受預設值
    • 在 [您是否要將其他主機新增至系統?] 底下:按下 [y]
    • 針對 [新增以逗號分隔的主機名稱]:輸入 hanadb2, hanadb3
    • 針對根使用者名稱 [root]:按下 Enter 鍵以接受預設值
    • 針對主機 hanadb2 的角色:輸入 1 (背景工作角色)
    • 針對主機 hanadb2 的 [主機容錯移轉群組] [預設]:按下 Enter 鍵以接受預設值
    • 針對主機 hanadb2 的 [儲存體分割區號碼] [<<自動指派>>]:按下 Enter 鍵以接受預設值
    • 針對主機 hanadb2 的背景工作角色群組 [預設]:按下 Enter 鍵以接受預設值
    • 針對主機 hanadb3 的 [選取角色]:輸入 2 (待命節點)
    • 針對主機 hanadb3 的 [主機容錯移轉群組] [預設]:按下 Enter 鍵以接受預設值
    • 針對主機 hanadb3 的 [背景工作角色群組] [預設]:按下 Enter 鍵以接受預設值
    • 針對 [SAP HANA 系統識別碼]:輸入 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) 密碼:輸入密碼
    • 針對 [系統資料庫使用者 (系統) 密碼]:輸入系統的密碼
    • 針對確認系統資料庫使用者 (系統) 密碼:輸入系統的密碼
    • 針對是否在電腦重新開機後重新啟動系統?[n]:輸入 n
    • 針對您是否要繼續 (y/n) :請驗證摘要,如果一切正常,請輸入 y
  2. [1] 驗證 global.ini

    顯示 global.ini,並確定內部 SAP HANA 節點間通訊的設定已就緒。 確認通訊區段。 其應具有 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.9.2.0/26
     listeninterface = .internal
     [internal_hostname_resolution]
     10.9.2.4 = hanadb1
     10.9.2.5 = hanadb2
     10.9.2.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.9.1.5
     map_hanadb2 = 10.9.1.6
     map_hanadb3 = 10.9.1.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 位址進行通訊。

    
     # Execute as 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.9.1.7"
     "hanadb2","net_publicname","10.9.1.6"
     "hanadb1","net_publicname","10.9.1.5"
    

    如需如何驗證設定的詳細資訊,請參閱 SAP 附註 2183363 - SAP Hana 內部網路的設定

  6. [A] 重新啟用防火牆。

    • 停止 HANA

      
         sudo -u hn1adm /usr/sap/hostctrl/exe/sapcontrol -nr 03 -function StopSystem HDB
        
    • 重新啟用防火牆

      
         # Execute as root
         systemctl start firewalld
         systemctl enable firewalld
        
    • 開啟必要的防火牆連接埠

      重要

      建立防火牆規則以允許 HANA 節點間通訊和用戶端流量。 所有 SAP 產品的 TCP/IP 通訊埠會列出必要的連接埠。 下列命令只是範例。 此案例中已使用系統號碼 03。

      
         # Execute as root
         sudo firewall-cmd --zone=public --add-port={30301,30303,30306,30307,30313,30315,30317,30340,30341,30342,1128,1129,40302,40301,40307,40303,40340,50313,50314,30310,30302}/tcp --permanent
         sudo firewall-cmd --zone=public --add-port={30301,30303,30306,30307,30313,30315,30317,30340,30341,30342,1128,1129,40302,40301,40307,40303,40340,50313,50314,30310,30302}/tcp
        
    • 啟動 HANA

      
         sudo -u hn1adm /usr/sap/hostctrl/exe/sapcontrol -nr 03 -function StartSystem HDB
        
  7. 若要最佳化基礎 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 all

    如需詳細資訊,請參閱適用於 SAP Hana 的 I/O 堆疊組態

    從 SAP Hana 2.0 系統開始,您可以在 global.ini 中設定參數。 如需詳細資訊,請參閱 SAP 附註 1999930

    針對 SAP HANA 1.0 系統版本 SPS12 和更早版本,您可以在安裝期間設定這些參數,如 SAP 附註 2267798 中所述。

  8. Azure NetApp Files 所使用的儲存體檔案大小限制為 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 容錯移轉

  1. 模擬 SAP HANA 背景工作節點上的節點損毀。 執行下列操作:

    a. 在模擬節點損毀之前,請以 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
    

    b. 若要模擬節點損毀,請在背景工作節點 (在此案例中為 hanadb2) 上,以 root 身分執行下列命令:

    
     echo b > /proc/sysrq-trigger
    

    c. 監視系統完成容錯移轉。 在容錯移轉完成時擷取狀態,狀態應該如下所示:

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

    重要

    當節點遇到核心異常狀況時,請在「所有」 HANA 虛擬機器上將 kernel.panic 設為 20 秒,以避免 SAP HANA 容錯移轉發生延遲。 設定會在 /etc/sysctl 中完成。 重新啟動虛擬機器以啟用變更。 如果未執行這項變更,當節點發生核心異常時,容錯移轉可能需要 10 分鐘以上的時間。

  2. 執行下列動作來終止名稱伺服器:

    a. 在測試之前,請以 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 | 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
     hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
     hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
    

    b. 在作用中的主要節點 (在此案例中為 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
      hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
      hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, 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 | 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 |
     

    c. 在 hanadb1 上重新啟動 HANA 執行個體 (也就是在名稱伺服器終止的同一部虛擬機器上)。 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
     hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
     hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
     hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, 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 |
    

    d. 同樣地,在目前作用中的主要節點上終止名稱伺服器 (也就是在 hanadb3 節點上)。

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

    hanadb1 節點會恢復主要節點的角色。 容錯移轉測試完成之後,狀態看起來會像這樣:

    
     # 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
     hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GRAY
     hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, 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    | 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 | -       |
    

    e. 在 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
     hanadb2, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, GREEN
     hanadb3, 3, 50313, 50314, 0.3, HDB|HDB_STANDBY, GREEN
     hanadb1, 3, 50313, 50314, 0.3, HDB|HDB_WORKER, 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    | 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 | -       |
    

下一步