共用方式為


針對 SAP 應用程式使用 Azure NetApp Files 在 SUSE Linux Enterprise Server 上的 Azure VM 達到 SAP NetWeaver 高可用性

本文說明如何使用 Azure NetApp Files 設定 SAP NetWeaver 應用程式的高可用性。

針對 SLES for SAP Applications 15 上的新實作,建議在簡單掛接設定中為 SAP ASCS/ERS 部署高可用性。 本文中所述以 SAP 中心服務目錄之叢集控制檔案系統為依據的傳統 Pacemaker 設定,仍然受到支援

在範例設定、安裝命令等項目中,ASCS 執行個體為數字 00,ERS 執行個體為數字 01,主要應用程式執行個體 (PAS) 為數字 02,應用程式執行個體 (AAS) 則為 03。 其中會使用 SAP 系統識別碼 QAS。 本文不會詳細描述資料庫層。

請先閱讀下列 SAP Note 和文件:

概觀

SAP Netweaver 中央服務的高可用性 (HA) 需要共用儲存體。 到目前為止,若要在 SUSE Linux 上達到該目標,則需要單獨建置高可用性的 NFS 叢集。

現在,可以使用在 Azure NetApp Files 上部署的共用儲存體,來實現 SAP NetWeaver 高可用性。 針對共用儲存體使用 Azure NetApp Files,即無需額外的 NFS 叢集。 SAP Netweaver 中央服務 (ASCS/SCS) 的 HA 仍然需要 Pacemaker。

SAP NetWeaver 高可用性概觀

SAP NetWeaver ASCS、SAP NetWeaver SCS、SAP NetWeaver ERS 和 SAP Hana 資料庫會使用虛擬主機名稱和虛擬 IP 位址。 在 Azure 上,需要具備負載平衡器才能使用虛擬 IP 位址。 我們建議使用 tandard Load Balancer。 顯示的設定會顯示以下內容的負載平衡器:

  • 適用於 ASCS 的前端 IP 位址 10.1.1.20
  • 適用於 ERS 的前端 IP 位址 10.1.1.21
  • 適用於 ASCS 的探查連接埠 62000
  • 適用於 ERS 的探查連接埠 62101

設定 Azure NetApp Files 基礎結構

SAP NetWeaver 需要傳輸和設定檔目錄的共用儲存體。 在繼續設定 Azure NetApp 檔案基礎結構之前,請先熟悉 Azure NetApp Files 文件。 檢查選取的 Azure 區域是否提供 Azure NetApp 檔案。 下列連結會依據 Azure 區域顯示 Azure NetApp Files 的可用性:Azure NetApp Files 可用性 (依 Azure 區域)

Azure NetApp 檔案可在數個 Azure 區域中提供使用。

部署 Azure NetApp Files 資源

這些步驟假設已部署 Azure 虛擬網路。 Azure NetApp Files 資源和 VM,其中將掛接的 Azure NetApp Files 資源必須部署到相同的 Azure 虛擬網路,或部署到對等互連 Azure 虛擬網路。

  1. 遵循建立 NetApp 帳戶的指示,在選取的 Azure 區域內建立 NetApp 帳戶。
  2. 遵循設定 Azure NetApp Files 容量集區的指示,設定 Azure NetApp Files 容量集區。
    本文中呈現的 SAP Netweaver 架構使用單一 Azure NetApp Files 容量集區,以及進階 SKU。 我們建議針對 Azure 上的 SAP Netweaver 應用程式工作負載使用 Azure NetApp Files 進階 SKU。
  3. 遵循將子網路委派給 Azure NetApp Files 中的指示,將子網路委派給 Azure NetApp 檔案。
  4. 遵循建立 Azure NetApp Files 磁碟區的指示,部署 Azure NetApp Files 磁碟區。 在指定的 Azure NetApp Files 子網路中部署磁碟區。 Azure NetApp 磁碟區的 IP 位址會自動指派。 請記得,Azure NetApp Files 資源和 Azure VM 必須位於相同的 Azure 虛擬網路,或位於對等互連 Azure 虛擬網路中。 在本範例中,我們會使用兩個 Azure NetApp Files 磁碟區:sapQAS 和 trans。掛接到對應掛接點的檔案路徑為 /usrsapqas/sapmntQAS、/usrsapqas/usrsapQASsys 等。
    1. 磁碟區 sapQAS (nfs://10.1.0.4/usrsapqas/sapmntQAS)
    2. 磁碟區 sapQAS (nfs://10.1.0.4/usrsapqas/usrsapQASascs)
    3. 磁碟區 sapQAS (nfs://10.1.0.4/usrsapqas/usrsapQASsys)
    4. 磁碟區 sapQAS (nfs://10.1.0.4/usrsapqas/usrsapQASers)
    5. 磁碟區 trans (nfs://10.1.0.4/trans)
    6. 磁碟區 sapQAS (nfs://10.1.0.4/usrsapqas/usrsapQASpas)
    7. 磁碟區 sapQAS (nfs://10.1.0.4/usrsapqas/usrsapQASaas)

在本範例中,我們針對所有 SAP Netweaver 檔案系統使用了 Azure NetApp Files 來示範使用 Azure NetApp Files 的方式。 不需要透過 NFS 掛接的 SAP 檔案系統也可作為 Azure 磁碟儲存體來部署。 在本範例中,a-e 必須位於 Azure NetApp Files 上,f-g (即 /usr/sap/QAS/D02、/usr/sapQAS/D03) 可以作為 Azure 磁碟儲存體部署。

重要考量

針對 SUSE 高可用性架構上的 SAP Netweaver 考慮 Azure NetApp Files 時,請注意下列重要考量:

  • 如需磁碟區和容量集區限制,請參閱 Azure NetApp Files 資源限制
  • Azure NetApp Files 和所有虛擬機器 (將掛接 Azure NetApp Files 磁碟區的位置) 必須位於相同 Azure 虛擬網路中,或位於相同區域的對等互連虛擬網路中。 Azure NetApp Files 現在支援透過相同區域內的 VNET 對等互連進行存取。 Azure NetApp 尚不支援透過全域對等互連進行存取。
  • 選取的虛擬網路必須具有已委派給 Azure NetApp Files 的子網路。
  • Azure NetApp Files 磁碟區的輸送量和效能特性取決於磁碟區配額和服務等級,如 Azure NetApp Files 的服務等級中所述。 調整 SAP Azure NetApp 磁碟區的大小時,請確定產生的輸送量符合應用程式需求。
  • Azure NetApp Files 提供匯出原則:您可控制允許的用戶端、存取類型 (讀取及寫入、唯讀等)。
  • Azure NetApp Files 功能尚不會感知區域。 目前 Azure NetApp Files 功能不會部署在 Azure 區域的所有可用性區域中。 請注意部分 Azure 區域中的潛在延遲影響。
  • Azure NetApp Files 磁碟區可作為 NFSv3 或 NFSv4.1 磁碟區部署。 SAP 應用程式層 (ASCS/ERS、SAP 應用程式伺服器) 支援這兩個通訊協定。

準備基礎結構

SAP 執行個體的資源代理程式隨附於 SUSE Linux Enterprise Server for SAP Applications 中。 SUSE Linux Enterprise Server for SAP Applications 12 或 15 的映像可在 Azure Marketplace 取得。 您可以使用此映像來部署新的 VM。

透過 Azure 入口網站手動部署 Linux VM

本文件假設您已部署資源群組、Azure 虛擬網路、子網路。

使用 SLES for SAP Applications 映像部署虛擬機器。 選擇 SAP 系統支援的適當 SLES 映像版本。 您可以在任一可用性選項中部署 VM:虛擬機器擴展集、可用性區域或可用性設定組。

設定 Azure Load Balancer

在 VM 設定期間,您可以選擇在網路區段中建立或選取現有的負載平衡器。 請遵循下列步驟來設定標準負載平衡器,以進行 SAP ASCS 和 SAP ERS 的高可用性設定。

請遵循建立負載平衡器指南,使用 Azure 入口網站為高可用性 SAP 系統設定標準負載平衡器。 在設定負載平衡器期間,請考慮下列幾點。

  1. 前端 IP 設定:建立兩個前端 IP,一個用於 ASCS,另一個用於 ERS。 選取與您的 ASCS/ERS 虛擬機器相同的虛擬網路和子網路。
  2. 後端集區:建立後端集區,並新增 ASCS 和 ERS VM。
  3. 輸入規則:建立兩個負載平衡規則,一個用於 ASCS,另一個用於 ERS。 對於這兩個負載平衡規則,請遵循相同的步驟。
    • 前端 IP 位址:選取前端 IP
    • 後端集區:選取後端集區
    • 勾選 [高可用性連接埠]
    • 通訊協定:TCP
    • 健全狀態探查:使用下列詳細資料建立健全狀態探查 (適用於 ASCS 或 ERS)
      • 通訊協定:TCP
      • 連接埠:[例如:620<Instance-no.> 適用於 ASCS,621<Instance-no.> 適用於 ERS]
      • 間隔:5
      • 探查閾值:2
    • 閒置逾時 (分鐘):30
    • 勾選 [啟用浮動 IP]

注意

未遵守健全狀態探查設定屬性 numberOfProbes,在入口網站中又名為「狀況不良閾值」。 因此,若要控制連續探查成功或失敗的數目,請將屬性 "probeThreshold" 設定為 2。 目前無法使用 Azure 入口網站來設定此屬性,因此請使用 Azure CLIPowerShell 命令。

注意

當不具公用 IP 位址的 VM 放在內部 (沒有公用 IP 位址) Standard Azure Load Balancer 的後端集區時,除非另外設定來允許路由傳送至公用端點,否則不會有輸出網際網路連線能力。 如需如何實現輸出連線能力的詳細資料,請參閱在 SAP 高可用性案例中使用 Azure Standard Load Balancer 實現虛擬機器的公用端點連線能力

重要

  • 請勿在位於 Azure Load Balancer 後方的 Azure VM 上啟用 TCP 時間戳記。 啟用 TCP 時間戳記會導致健康狀態探查失敗。 將 net.ipv4.tcp_timestamps 參數設定為 0。 如需詳細資料,請參閱 Load Balancer 健康狀態探查
  • 若要防止 saptune 將手動設定的 net.ipv4.tcp_timestamps 值從 0 變更回 1,您應該將 saptune 版本更新為 3.1.1 或更高版本。 如需詳細資訊,請參閱 saptune 3.1.1 - 我需要更新嗎?

停用識別碼對應 (若使用 NFSv4.1)

本節中的指示只有在搭配 NFSv4.1 通訊協定使用 Azure NetApp Files 磁碟區時才適用。 在所有將掛接 Azure NetApp Files NFSv4.1 磁碟區的 VM 上執行設定。

  1. 驗證 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
    
  2. [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.1.0.4:/sapmnt/qas /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
    

設定 (A)SCS

接下來,您將準備並安裝 SAP ASCS 和 ERS 執行個體。

建立 Pacemaker 叢集

依照在 Azure 中於 SUSE Linux Enterprise Server 上設定 Pacemaker 中的步驟,建立此 (A)SCS 伺服器的基本 Pacemaker 叢集。

安裝

下列項目會加上下列其中一個前置詞:[A] - 適用於所有節點、[1] - 僅適用於節點 1 或 [2] - 僅適用於節點 2。

  1. [A] 安裝 SUSE 連接器

    sudo zypper install sap-suse-cluster-connector
    

    注意

    在主機名稱中使用虛線的已知問題,已經在 sap-suse-cluster-connector 套件的版本 3.1.1 中修正。 若要在主機名稱中使用虛線,請確認正在使用的 sap-suse-cluster-connector 套件版本至少為 3.1.1。 否則叢集將無法運作。

    請確定您已安裝新版的 SAP SUSE 叢集連接器。 舊版連接器稱為 sap_suse_cluster_connector,新版連接器稱為 sap-suse-cluster-connector

    sudo zypper info sap-suse-cluster-connector
    
    # Information for package sap-suse-cluster-connector:
    # ---------------------------------------------------
    # Repository     : SLE-12-SP3-SAP-Updates
    # Name           : sap-suse-cluster-connector
    # Version        : 3.1.0-8.1
    # Arch           : noarch
    # Vendor         : SUSE LLC <https://www.suse.com/>
    # Support Level  : Level 3
    # Installed Size : 45.6 KiB
    # Installed      : Yes
    # Status         : up-to-date
    # Source package : sap-suse-cluster-connector-3.1.0-8.1.src
    # Summary        : SUSE High Availability Setup for SAP Products
    
  2. [A] 更新 SAP 資源代理程式

    資源代理程式套件必須有修補程式才能使用新的組態,本文會有該修補程式的說明。 您可以查看您是否已使用下列命令安裝了修補程式

    sudo grep 'parameter name="IS_ERS"' /usr/lib/ocf/resource.d/heartbeat/SAPInstance
    

    輸出應該會類似

    <parameter name="IS_ERS" unique="0" required="0">
    

    如果 grep 命令找不到 IS_ERS 參數,您必須安裝 SUSE 下載頁面所列出的修補程式

    # example for patch for SLES 12 SP1
    sudo zypper in -t patch SUSE-SLE-HA-12-SP1-2017-885=1
    
    # example for patch for SLES 12 SP2
    sudo zypper in -t patch SUSE-SLE-HA-12-SP2-2017-886=1
    
  3. [A] 設定主機名稱解析

    您可以使用 DNS 伺服器,或修改所有節點上的 /etc/hosts。 這個範例示範如何使用 /etc/hosts 檔案。 取代下列命令中的 IP 位址和主機名稱

    sudo vi /etc/hosts
    

    將下列幾行插入至 /etc/hosts。 變更 IP 位址和主機名稱以符合您的環境

    # IP address of cluster node 1
    10.1.1.18    anftstsapcl1
    # IP address of cluster node 2
    10.1.1.6     anftstsapcl2
    # IP address of the load balancer frontend configuration for SAP Netweaver ASCS
    10.1.1.20    anftstsapvh
    # IP address of the load balancer frontend configuration for SAP Netweaver ERS
    10.1.1.21    anftstsapers
    
  4. [1] 在 Azure NetApp Files 磁碟區中建立 SAP 目錄。

    將 Azure NetApp Files 磁碟區暫時掛接在其中一部 VM 上,然後建立 SAP 目錄 (檔案路徑)。

    # mount temporarily the volume
    sudo mkdir -p /saptmp
    # If using NFSv3
    sudo mount -t nfs -o rw,hard,rsize=65536,wsize=65536,nfsvers=3,tcp 10.1.0.4:/sapQAS /saptmp
    # If using NFSv4.1
    sudo mount -t nfs -o rw,hard,rsize=65536,wsize=65536,nfsvers=4.1,sec=sys,tcp 10.1.0.4:/sapQAS /saptmp
    # create the SAP directories
    sudo cd /saptmp
    sudo mkdir -p sapmntQAS
    sudo mkdir -p usrsapQASascs
    sudo mkdir -p usrsapQASers
    sudo mkdir -p usrsapQASsys
    sudo mkdir -p usrsapQASpas
    sudo mkdir -p usrsapQASaas
    # unmount the volume and delete the temporary directory
    sudo cd ..
    sudo umount /saptmp
    sudo rmdir /saptmp
    

準備進行 SAP NetWeaver 安裝

  1. [A] 建立共用目錄

    sudo mkdir -p /sapmnt/QAS
    sudo mkdir -p /usr/sap/trans
    sudo mkdir -p /usr/sap/QAS/SYS
    sudo mkdir -p /usr/sap/QAS/ASCS00
    sudo mkdir -p /usr/sap/QAS/ERS01
    
    sudo chattr +i /sapmnt/QAS
    sudo chattr +i /usr/sap/trans
    sudo chattr +i /usr/sap/QAS/SYS
    sudo chattr +i /usr/sap/QAS/ASCS00
    sudo chattr +i /usr/sap/QAS/ERS01
    
  2. [A] 設定 autofs

    sudo vi /etc/auto.master
    
    # Add the following line to the file, save and exit
    /- /etc/auto.direct
    

    若使用 NFSv3,請使用以下內容建立檔案:

    sudo vi /etc/auto.direct
    
    # Add the following lines to the file, save and exit
    /sapmnt/QAS -nfsvers=3,nobind 10.1.0.4:/usrsapqas/sapmntQAS
    /usr/sap/trans -nfsvers=3,nobind 10.1.0.4:/trans
    /usr/sap/QAS/SYS -nfsvers=3,nobind 10.1.0.4:/usrsapqas/usrsapQASsys
    

    若使用 NFSv4.1,請使用以下內容建立檔案:

    sudo vi /etc/auto.direct
    
    # Add the following lines to the file, save and exit
    /sapmnt/QAS -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/usrsapqas/sapmntQAS
    /usr/sap/trans -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/trans
    /usr/sap/QAS/SYS -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/usrsapqas/usrsapQASsys
    

    注意

    請務必在掛接磁碟區時比對 Azure NetApp Files 磁碟區的 NFS 通訊協定版本。 若 Azure NetApp Files 磁碟區是使用 NFSv3 磁碟區建立的,請使用對應的 NFSv3 設定。 若 Azure NetApp Files 磁碟區是使用 NFSv4.1 磁碟區建立的,請遵循指示來停用識別碼對應,並確認使用對應的 NFSv4.1 設定。 在本範例中,Azure NetApp Files 磁碟區是使用 NFSv3 磁碟區建立的。

    重新啟動 autofs 來掛接新的共用

    sudo systemctl enable autofs
    sudo service autofs restart
    
  3. [A] 設定分頁檔

    sudo vi /etc/waagent.conf
    
    # Check if property ResourceDisk.Format is already set to y and if not, set it
    ResourceDisk.Format=y
    
    # Set the property ResourceDisk.EnableSwap to y
    # Create and use swapfile on resource disk.
    ResourceDisk.EnableSwap=y
    
    # Set the size of the SWAP file with property ResourceDisk.SwapSizeMB
    # The free space of resource disk varies by virtual machine size. Make sure that you do not set a value that is too big. You can check the SWAP space with command swapon
    # Size of the swapfile.
    ResourceDisk.SwapSizeMB=2000
    

    重新啟動代理程式以啟動變更

    sudo service waagent restart
    

安裝 SAP NetWeaver ASCS/ERS

  1. [1] 為 ASCS 執行個體建立虛擬 IP 資源和健康情況探查

    重要

    最近測試顯示 netcat 會因待處理項目及其僅處理單一連線的限制,而停止回應要求的狀況。 Netcat 資源會停止接聽 Azure Load Balancer 要求,使浮動 IP 無法使用。
    針對現有的 Pacemaker 叢集,我們在過去建議將 netcat 取代成 socat。 目前建議使用 azure-lb 資源代理程式,其為 resource-agents 套件的一部分,並包含下列套件版本需求:

    • 針對 SLES 12 SP4/SP5,版本必須至少為 resource-agents-4.3.018.a7fb5035-3.30.1。
    • 針對 SLES 15/15 SP1,版本必須至少為 resource-agents-4.3.0184.6ee15eb2-4.13.1。

    請注意,變更將會需要短暫的停機。
    針對現有的 Pacemaker 叢集,若設定已按照 Azure Load Balancer 偵測強化中的描述變更為使用 socat,則沒有立即切換至 azure-lb 資源代理程式的需求。

    sudo crm node standby anftstsapcl2
    
    # If using NFSv3
    sudo crm configure primitive fs_QAS_ASCS Filesystem device='10.1.0.4/usrsapqas/usrsapQASascs' directory='/usr/sap/QAS/ASCS00' fstype='nfs' \
      op start timeout=60s interval=0 \
      op stop timeout=60s interval=0 \
      op monitor interval=20s timeout=40s
    
    # If using NFSv4.1
    sudo crm configure primitive fs_QAS_ASCS Filesystem device='10.1.0.4:/usrsapqas/usrsapQASascs' directory='/usr/sap/QAS/ASCS00' fstype='nfs' options='sec=sys,nfsvers=4.1' \
      op start timeout=60s interval=0 \
      op stop timeout=60s interval=0 \
      op monitor interval=20s timeout=105s
    
    sudo crm configure primitive vip_QAS_ASCS IPaddr2 \
      params ip=10.1.1.20 \
      op monitor interval=10 timeout=20
    
    sudo crm configure primitive nc_QAS_ASCS azure-lb port=62000 \
      op monitor timeout=20s interval=10
    
    sudo crm configure group g-QAS_ASCS fs_QAS_ASCS nc_QAS_ASCS vip_QAS_ASCS \
       meta resource-stickiness=3000
    

    請確定叢集狀態正常,且所有資源皆已啟動。 資源在哪個節點上執行並不重要。

    sudo crm_mon -r
    
    # Node anftstsapcl2: standby
    # Online: [ anftstsapcl1 ]
    # 
    # Full list of resources:
    #
    # Resource Group: g-QAS_ASCS
    #     fs_QAS_ASCS        (ocf::heartbeat:Filesystem):    Started anftstsapcl1
    #     nc_QAS_ASCS        (ocf::heartbeat:azure-lb):      Started anftstsapcl1
    #     vip_QAS_ASCS       (ocf::heartbeat:IPaddr2):       Started anftstsapcl1
    # stonith-sbd     (stonith:external/sbd): Started anftstsapcl2
    
  2. [1] 安裝 SAP NetWeaver ASCS

    以 root 身分使用虛擬主機名稱 (對應至 ASCS 負載平衡器前端設定的 IP 位址,例如 anftstsapvh10.1.1.20) 和用於負載平衡器探查的執行個體號碼 (例如 00),在第一個節點上安裝 SAP NetWeaver ASCS。

    您可以使用 sapinst 參數 SAPINST_REMOTE_ACCESS_USER 來允許非 root 使用者連線到 sapinst。 您可搭配虛擬主機名稱,使用 SAPINST_USE_HOSTNAME 參數來安裝 SAP。

    sudo <swpm>/sapinst SAPINST_REMOTE_ACCESS_USER=sapadmin SAPINST_USE_HOSTNAME=virtual_hostname
    

    如果安裝無法在 /usr/sap/QAS/ASCS00 中建立子資料夾,請嘗試設定 ASCS00 資料夾的擁有者和群組,並進行重試。

    chown qasadm /usr/sap/QAS/ASCS00
    chgrp sapsys /usr/sap/QAS/ASCS00
    
  3. [1] 為 ERS 執行個體建立虛擬 IP 資源和健全狀態探查。

    sudo crm node online anftstsapcl2
    sudo crm node standby anftstsapcl1
    
    # If using NFSv3
    sudo crm configure primitive fs_QAS_ERS Filesystem device='10.1.0.4:/usrsapqas/usrsapQASers' directory='/usr/sap/QAS/ERS01' fstype='nfs' \
      op start timeout=60s interval=0 \
      op stop timeout=60s interval=0 \
      op monitor interval=20s timeout=40s
    
    # If using NFSv4.1
    sudo crm configure primitive fs_QAS_ERS Filesystem device='10.1.0.4:/usrsapqas/usrsapQASers' directory='/usr/sap/QAS/ERS01' fstype='nfs' options='sec=sys,nfsvers=4.1' \
      op start timeout=60s interval=0 \
      op stop timeout=60s interval=0 \
      op monitor interval=20s timeout=105s
    
    sudo crm configure primitive vip_QAS_ERS IPaddr2 \
      params ip=10.1.1.21 \
      op monitor interval=10 timeout=20
    
    sudo crm configure primitive nc_QAS_ERS azure-lb port=62101 \
      op monitor timeout=20s interval=10
    
    sudo crm configure group g-QAS_ERS fs_QAS_ERS nc_QAS_ERS vip_QAS_ERS
    

    請確定叢集狀態正常,且所有資源皆已啟動。 資源在哪個節點上執行並不重要。

    sudo crm_mon -r
    
    # Node anftstsapcl1: standby
    # Online: [ anftstsapcl2 ]
    # 
    # Full list of resources:
    #
    # stonith-sbd     (stonith:external/sbd): Started anftstsapcl2
    #  Resource Group: g-QAS_ASCS
    #      fs_QAS_ASCS        (ocf::heartbeat:Filesystem):    Started anftstsapcl2
    #      nc_QAS_ASCS        (ocf::heartbeat:azure-lb):      Started anftstsapcl2
    #      vip_QAS_ASCS       (ocf::heartbeat:IPaddr2):       Started anftstsapcl2
    #  Resource Group: g-QAS_ERS
    #      fs_QAS_ERS (ocf::heartbeat:Filesystem):    Started anftstsapcl2
    #      nc_QAS_ERS (ocf::heartbeat:azure-lb):      Started anftstsapcl2
    #      vip_QAS_ERS  (ocf::heartbeat:IPaddr2):     Started anftstsapcl2
    
  4. [2] 安裝 SAP NetWeaver ERS

    以 root 身分使用虛擬主機名稱 (對應至 ERS 負載平衡器前端設定的 IP 位址,例如 anftstsapers10.1.1.21) 和用於負載平衡器探查的執行個體號碼 (例如 01),在第二個節點上安裝 SAP NetWeaver ERS。

    您可以使用 sapinst 參數 SAPINST_REMOTE_ACCESS_USER 來允許非 root 使用者連線到 sapinst。 您可搭配虛擬主機名稱,使用 SAPINST_USE_HOSTNAME 參數來安裝 SAP。

    sudo <swpm>/sapinst SAPINST_REMOTE_ACCESS_USER=sapadmin SAPINST_USE_HOSTNAME=virtual_hostname
    

    注意

    請使用 SWPM SP 20 PL 05 或更高版本。 較低版本無法正確設定權限,因而會讓安裝失敗。

    如果安裝無法在 /usr/sap/QAS/ERS01 中建立子資料夾,請嘗試設定 ERS01 資料夾的擁有者和群組,並進行重試。

    chown qasadm /usr/sap/QAS/ERS01
    chgrp sapsys /usr/sap/QAS/ERS01
    
  5. [1] 調整 ASCS/SCS 和 ERS 執行個體設定檔

    • ASCS/SCS 設定檔

      sudo vi /sapmnt/QAS/profile/QAS_ASCS00_anftstsapvh
      
      # Change the restart command to a start command
      #Restart_Program_01 = local $(_EN) pf=$(_PF)
      Start_Program_01 = local $(_EN) pf=$(_PF)
      
      # Add the following lines
      service/halib = $(DIR_CT_RUN)/saphascriptco.so
      service/halib_cluster_connector = /usr/bin/sap_suse_cluster_connector
      
      # Add the keep alive parameter, if using ENSA1
      enque/encni/set_so_keepalive = true
      

      針對 ENSA1 和 ENSA2,請確定已如 SAP 附註 1410736 中所述設定 keepalive OS 參數。

    • ERS 設定檔

      sudo vi /sapmnt/QAS/profile/QAS_ERS01_anftstsapers
      
      # Change the restart command to a start command
      #Restart_Program_00 = local $(_ER) pf=$(_PFL) NR=$(SCSID)
      Start_Program_00 = local $(_ER) pf=$(_PFL) NR=$(SCSID)
      
      # Add the following lines
      service/halib = $(DIR_CT_RUN)/saphascriptco.so
      service/halib_cluster_connector = /usr/bin/sap_suse_cluster_connector
      
      # remove Autostart from ERS profile
      # Autostart = 1
      
  6. [A] 設定保持運作

    SAP NetWeaver 應用程式伺服器和 ASCS/SCS 之間的通訊是透過軟體負載平衡器來路由傳送。 在逾時時間 (可設定) 過後,負載平衡器就會將非作用中的連線中斷。 若要避免這種情況,您必須在 SAP NetWeaver ASCS/SCS 設定檔中設定參數 (若使用 ENSA1),並在 ENSA1/ENSA2 的所有 SAP 伺服器上變更 Linux 系統 keepalive 設定。 如需詳細資訊,請閱讀 SAP Note 1410736

    # Change the Linux system configuration
    sudo sysctl net.ipv4.tcp_keepalive_time=300
    
  7. [A] 在安裝過後設定 SAP 使用者

    # Add sidadm to the haclient group
    sudo usermod -aG haclient qasadm
    
  8. [1]sapservice 檔案中新增 ASCS 和 ERS SAP 服務

    在第二個節點中新增 ASCS 服務項目,並將 ERS 服務項目複製到第一個節點。

    cat /usr/sap/sapservices | grep ASCS00 | sudo ssh anftstsapcl2 "cat >>/usr/sap/sapservices"
    sudo ssh anftstsapcl2 "cat /usr/sap/sapservices" | grep ERS01 | sudo tee -a /usr/sap/sapservices
    
  9. [A] 停用 ASCS 和 ERS SAP 執行個體的 systemd 服務。 只有當 SAP 啟動架構由 systemd 根據 SAP 備註 3115048 管理時,此步驟才適用

    注意

    使用 SLES 叢集設定管理 SAP ASCS 和 SAP ERS 之類的 SAP 執行個體時,您必須進行其他修改,以將叢集與以 systemd 為基礎的原生 SAP 啟動架構進行整合。 這可確保維護流程不會危害叢集穩定性。 根據 SAP 備註 3115048,安裝或將 SAP 啟動架構切換至已啟用 systemd 的安裝之後,您應該停用 ASCS 和 ERS SAP 執行個體的 systemd 服務。

    # Stop ASCS and ERS instances using <sid>adm
    sapcontrol -nr 00 -function Stop
    sapcontrol -nr 00 -function StopService
    
    sapcontrol -nr 01 -function Stop
    sapcontrol -nr 01 -function StopService
    
    # Execute below command on VM where you have performed ASCS instance installation (e.g. anftstsapcl1)
    sudo systemctl disable SAPQAS_00
    # Execute below command on VM where you have performed ERS instance installation (e.g. anftstsapcl2)
    sudo systemctl disable SAPQAS_01
    
  10. [1] 建立 SAP 叢集資源。

    根據您執行的是 ENSA1 還是 ENSA2 系統,選取各自的索引標籤以定義資源。 SAP 在 SAP NetWeaver 7.52 中引進了 ENSA2 的支援,包括複寫。 從 ABAP 平台 1809 開始,預設會安裝 ENSA2。 如需 ENSA2 支援,請參閱 SAP 附註 2630416

    sudo crm configure property maintenance-mode="true"
    
    # If using NFSv3
    sudo crm configure primitive rsc_sap_QAS_ASCS00 SAPInstance \
       operations \$id=rsc_sap_QAS_ASCS00-operations \
       op monitor interval=11 timeout=60 on-fail=restart \
       params InstanceName=QAS_ASCS00_anftstsapvh START_PROFILE="/sapmnt/QAS/profile/QAS_ASCS00_anftstsapvh" \
       AUTOMATIC_RECOVER=false \
       meta resource-stickiness=5000 failure-timeout=60 migration-threshold=1 priority=10
    
    # If using NFSv4.1
    sudo crm configure primitive rsc_sap_QAS_ASCS00 SAPInstance \
       operations \$id=rsc_sap_QAS_ASCS00-operations \
       op monitor interval=11 timeout=105 on-fail=restart \
       params InstanceName=QAS_ASCS00_anftstsapvh START_PROFILE="/sapmnt/QAS/profile/QAS_ASCS00_anftstsapvh" \
       AUTOMATIC_RECOVER=false \
       meta resource-stickiness=5000 failure-timeout=105 migration-threshold=1 priority=10
    
    # If using NFSv3   
    sudo crm configure primitive rsc_sap_QAS_ERS01 SAPInstance \
       operations \$id=rsc_sap_QAS_ERS01-operations \
       op monitor interval=11 timeout=60 on-fail=restart \
       params InstanceName=QAS_ERS01_anftstsapers START_PROFILE="/sapmnt/QAS/profile/QAS_ERS01_anftstsapers" AUTOMATIC_RECOVER=false IS_ERS=true \
       meta priority=1000
    
    # If using NFSv4.1
    sudo crm configure primitive rsc_sap_QAS_ERS01 SAPInstance \
       operations \$id=rsc_sap_QAS_ERS01-operations \
       op monitor interval=11 timeout=105 on-fail=restart \
       params InstanceName=QAS_ERS01_anftstsapers START_PROFILE="/sapmnt/QAS/profile/QAS_ERS01_anftstsapers" AUTOMATIC_RECOVER=false IS_ERS=true \
       meta priority=1000
    
    sudo crm configure modgroup g-QAS_ASCS add rsc_sap_QAS_ASCS00
    sudo crm configure modgroup g-QAS_ERS add rsc_sap_QAS_ERS01
    
    sudo crm configure colocation col_sap_QAS_no_both -5000: g-QAS_ERS g-QAS_ASCS
    sudo crm configure location loc_sap_QAS_failover_to_ers rsc_sap_QAS_ASCS00 rule 2000: runs_ers_QAS eq 1
    sudo crm configure order ord_sap_QAS_first_start_ascs Optional: rsc_sap_QAS_ASCS00:start rsc_sap_QAS_ERS01:stop symmetrical=false
    
    sudo crm_attribute --delete --name priority-fencing-delay
    
    sudo crm node online anftstsapcl1
    sudo crm configure property maintenance-mode="false"
    

若正在從舊版本升級並切換到加入佇列伺服器 2,請參閱 SAP 附註 2641019

注意

由於通訊協定特定的暫停 (與 NFSv4.1 租用更新相關),因此使用 NFSv 4.1 時必然會發生高於建議的逾時。 如需詳細資訊,請參閱 NetApp 中的 NFS 最佳做法

上述設定中的逾時可能需要針對特定的 SAP 設定進行調整。

請確定叢集狀態正常,且所有資源皆已啟動。 資源在哪個節點上執行並不重要。

sudo crm_mon -r
  
# Full list of resources:
#
# stonith-sbd     (stonith:external/sbd): Started anftstsapcl2
#  Resource Group: g-QAS_ASCS
#      fs_QAS_ASCS        (ocf::heartbeat:Filesystem):    Started anftstsapcl1
#      nc_QAS_ASCS        (ocf::heartbeat:azure-lb):      Started anftstsapcl1
#      vip_QAS_ASCS       (ocf::heartbeat:IPaddr2):       Started anftstsapcl1
#      rsc_sap_QAS_ASCS00 (ocf::heartbeat:SAPInstance):   Started anftstsapcl1
#  Resource Group: g-QAS_ERS
#      fs_QAS_ERS (ocf::heartbeat:Filesystem):    Started anftstsapcl2
#      nc_QAS_ERS (ocf::heartbeat:azure-lb):      Started anftstsapcl2
#      vip_QAS_ERS        (ocf::heartbeat:IPaddr2):       Started anftstsapcl2
#      rsc_sap_QAS_ERS01  (ocf::heartbeat:SAPInstance):   Started anftstsapcl2

SAP NetWeaver 應用程式伺服器準備

某些資料庫需要在應用程式伺服器上執行資料庫執行個體安裝。 準備應用程式伺服器虛擬機器,以便在這些情況下使用它們。

以下步驟假設您將應用程式伺服器安裝在與 ASCS/SCS 和 HANA 伺服器不同的伺服器上。 否則,您就不必進行以下某些步驟 (例如設定主機名稱解析)。

下列項目會加上下列其中一個前置 [A] (適用於 PAS 和 AAS)、[P] (僅適用於 PAS),或 [S] (僅適用於 AAS)。

  1. [A] 設定作業系統

    縮減已變更的快取大小。 如需詳細資訊,請參閱使用大量 RAM 的 SLES 11/12 伺服器出現低寫入效能 (英文)。

    sudo vi /etc/sysctl.conf
    
    # Change/set the following settings
    vm.dirty_bytes = 629145600
    vm.dirty_background_bytes = 314572800
    
  2. [A] 設定主機名稱解析

    您可以使用 DNS 伺服器,或修改所有節點上的 /etc/hosts。 這個範例示範如何使用 /etc/hosts 檔案。 取代下列命令中的 IP 位址和主機名稱

    sudo vi /etc/hosts
    

    將下列幾行插入至 /etc/hosts。 變更 IP 位址和主機名稱以符合您的環境

    # IP address of the load balancer frontend configuration for SAP NetWeaver ASCS/SCS
    10.1.1.20 anftstsapvh
    # IP address of the load balancer frontend configuration for SAP NetWeaver ERS
    10.1.1.21 anftstsapers
    # IP address of all application servers
    10.1.1.15 anftstsapa01
    10.1.1.16 anftstsapa02
    
  3. [A] 建立 sapmnt 目錄

    sudo mkdir -p /sapmnt/QAS
    sudo mkdir -p /usr/sap/trans
    
    sudo chattr +i /sapmnt/QAS
    sudo chattr +i /usr/sap/trans
    
  4. [P] 建立 PAS 目錄

    sudo mkdir -p /usr/sap/QAS/D02
    sudo chattr +i /usr/sap/QAS/D02
    
  5. [S] 建立 AAS 目錄

    sudo mkdir -p /usr/sap/QAS/D03
    sudo chattr +i /usr/sap/QAS/D03
    
  6. [P] 在 PAS 上設定 autofs

    sudo vi /etc/auto.master
    
    # Add the following line to the file, save and exit
    /- /etc/auto.direct
    

    若使用 NFSv3,請使用以下內容建立新檔案:

    sudo vi /etc/auto.direct
    
    # Add the following lines to the file, save and exit
    /sapmnt/QAS -nfsvers=3,nobind 10.1.0.4:/usrsapqas/sapmntQAS
    /usr/sap/trans -nfsvers=3,nobind 10.1.0.4:/trans
    /usr/sap/QAS/D02 -nfsvers=3,nobind 10.1.0.4:/usrsapqas/usrsapQASpas
    

    若使用 NFSv4.1,請使用以下內容建立新檔案:

    sudo vi /etc/auto.direct
    # Add the following lines to the file, save and exit
    /sapmnt/QAS -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/usrsapqas/sapmntQAS
    /usr/sap/trans -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/trans
    /usr/sap/QAS/D02 -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/usrsapqas/usrsapQASpas
    

    重新啟動 autofs 來掛接新的共用

    sudo systemctl enable autofs
    sudo service autofs restart
    
  7. [P] 在 AAS 上設定 autofs

    sudo vi /etc/auto.master
    
    # Add the following line to the file, save and exit
    /- /etc/auto.direct
    

    若使用 NFSv3,請使用以下內容建立新檔案:

    sudo vi /etc/auto.direct
    
    # Add the following lines to the file, save and exit
    /sapmnt/QAS -nfsvers=3,nobind 10.1.0.4:/usrsapqas/sapmntQAS
    /usr/sap/trans -nfsvers=3,nobind 10.1.0.4:/trans
    /usr/sap/QAS/D03 -nfsvers=3,nobind 10.1.0.4:/usrsapqas/usrsapQASaas
    

    若使用 NFSv4.1,請使用以下內容建立新檔案:

    sudo vi /etc/auto.direct
    
    # Add the following lines to the file, save and exit
    /sapmnt/QAS -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/usrsapqas/sapmntQAS
    /usr/sap/trans -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/trans
    /usr/sap/QAS/D03 -nfsvers=4.1,nobind,sec=sys 10.1.0.4:/usrsapqas/usrsapQASaas
    

    重新啟動 autofs 來掛接新的共用

    sudo systemctl enable autofs
    sudo service autofs restart
    
  8. [A] 設定分頁檔

    sudo vi /etc/waagent.conf
    
    # Set the property ResourceDisk.EnableSwap to y
    # Create and use swapfile on resource disk.
    ResourceDisk.EnableSwap=y
    
    # Set the size of the SWAP file with property ResourceDisk.SwapSizeMB
    # The free space of resource disk varies by virtual machine size. Make sure that you do not set a value that is too big. You can check the SWAP space with command swapon
    # Size of the swapfile.
    ResourceDisk.SwapSizeMB=2000
    

    重新啟動代理程式以啟動變更

    sudo service waagent restart
    

安裝資料庫

在此範例中,SAP NetWeaver 安裝在 SAP Hana 上。 您可以針對此安裝使用每個支援的資料庫。 如需如何在 Azure 上安裝 SAP HANA 的詳細資訊,請參閱 Azure 虛擬機器 (VM) 上 SAP HANA 的高可用性。 如需所支援資料庫的清單,請參閱 SAP Note 1928533

  • 執行 SAP 資料庫執行個體安裝

    以 root 身分使用虛擬主機名稱 (對應至資料庫負載平衡器前端設定的 IP 位址) 來安裝 SAP NetWeaver 資料庫執行個體。

    您可以使用 sapinst 參數 SAPINST_REMOTE_ACCESS_USER 來允許非 root 使用者連線到 sapinst。

    sudo <swpm>/sapinst SAPINST_REMOTE_ACCESS_USER=sapadmin
    

SAP NetWeaver 應用程式伺服器安裝

請遵循下列步驟來安裝 SAP 應用程式伺服器。

  1. [A] 準備應用程式伺服器:遵循<SAP Netweaver 應用程式伺服器準備>一章中的步驟來準備應用程式伺服器。

  2. [A]安裝 SAP NetWeaver 應用程式伺服器:安裝主要或其他的 SAP NetWeaver 應用程式伺服器。

    您可以使用 sapinst 參數 SAPINST_REMOTE_ACCESS_USER 來允許非 root 使用者連線到 sapinst。

    sudo <swpm>/sapinst SAPINST_REMOTE_ACCESS_USER=sapadmin
    
  3. [A] 更新 SAP HANA 安全存放區

    將 SAP HANA 安全存放區更新為指向 SAP HANA 系統複寫設定的虛擬名稱。

    執行下列命令來列出項目

    hdbuserstore List
    

    這樣應該會列出所有項目,且看起來應該類似

    DATA FILE       : /home/qasadm/.hdb/anftstsapa01/SSFS_HDB.DAT
    KEY FILE        : /home/qasadm/.hdb/anftstsapa01/SSFS_HDB.KEY
    
    KEY DEFAULT
      ENV : 10.1.1.5:30313
      USER: SAPABAP1
      DATABASE: QAS
    

    輸出會顯示預設項目的 IP 位址指向虛擬機器,而不是指向負載平衡器的 IP 位址。 這個項目必須變更才能指向負載平衡器的虛擬機器主機名稱。 請務必使用相同的連接埠 (上述輸出中的 30313) 和資料庫名稱 (上述輸出中的 QAS)!

    su - qasadm
    
    hdbuserstore SET DEFAULT qasdb:30313@QAS SAPABAP1 <password of ABAP schema>
    

測試叢集設定

徹底測試 Pacemaker 叢集。 執行一般容錯移轉測試

下一步