Translated message

A translation of this page exists in English.

OpenShift Virtualization を使用した SAP ワークロードのデプロイ

更新 -

注記: Red Hat は、テストおよび開発環境の OpenShift Virtualization でワークロードをテストして経験を積むことをお客様に推奨しています。SAP は、OpenShift Virtualization にデプロイされた SAP HANA および SAP ビジネスアプリケーションをサポートしません。Red Hat は、ワークロードとは関係なく OpenShift Virtualization を完全にサポートしています。

目次

1.前提条件

  • 4.12 または 4.14 OpenShift クラスター。
  • ワーカーノード:
    • 少なくとも 96 GB の RAM (注記: 最小メモリーチェックはお客様の責任のもと無効にできます)。
    • 同一のワーカーノード (ベンダー、CPU、RAM、ディスク、ネットワークが同じ)。
  • ストレージ: OpenShift Data Foundation、NFS、またはローカルディスク。
  • Ansible リリース 1.3.5 から community.sap_install コレクション をチェックアウトしている。
  • Ansible の sap_create_vm ロール。

2.手順

次の手順は、OpenShift Virtualization に SAP ワークロードをデプロイするために必要なプロセスの概要を示しています。このガイドでは、手順 2 と 3 に重点をおいています。

  1. OpenShift クラスターをインストールします。この操作は本ドキュメントに含まれていません。OpenShift のインストール方法について、詳細は Installing a user-provisioned cluster on bare metal を参照してください。OpenShift クラスターの自動インストール方法については、https://github.com/agonzalezrh/install_openshift を参照してください。
  2. sap_hypervisor_preconfigure ロールを使用して、SAP ワークロード用のワーカーノードを設定します。
  3. sap_create_vm ロールを使用して、1 つ以上の仮想マシンを作成します。
  4. Ansible パスに sap_* ロールがあることを確認します。
  5. SAP ワークロードをデプロイします。
    a. community.sap_install.sap_swpm を使用して NetWeaver、または
    b. community.sap_install.sap_hana_install を使用して SAP HANA。

3.Ansible ロール

バージョン 1.3.5 を使用して、Ansible Galaxy から Ansible コレクションをインストールします。

# ansible-galaxy collection install community.sap_install

3.1 sap_hypervisor_node_preconfigure を使用して SAP ワークロード用のクラスターを設定する

OpenShift クラスターの設定には、sap_hypervisor_node_preconfigure ロールを使用します。以下の手順が自動的に実行されます。

  1. 調整済みプロファイルを virtual-host に設定します。
  2. CNV Operator をインストールします。
  3. SRIOV Operator をインストールします。
  4. nmstate Operator をインストールします。
  5. virtctl をダウンロードしてインストールします。
  6. 次の手順を実行してワーカーノードを設定します。
    a. 次のカーネルパラメーターを設定します。

    intel_iommu=on iommu=pt default_hugepagesz=1GB hugepagesz=1GB hugepages=<#1GBHugepages> tsx=on
    

    huge page について: 定義されたすべてのワーカーノードで、次の式を使用して HP のサイズが決定されます。

    [Amount of RAM in worker] - 32 GB if [Amount of RAM] < 512 GB, 
                                        64 GB otherwise
    

    b. CPU マネージャーを有効にします。
    c. ネットワークを設定します。SRIOV または Linux-Bridge (オプション)。

  7. Trident をインストールして設定します (オプション)。
  8. ローカルストレージを設定します (オプション)。

3.1.1. 要件

  • OpenShift クラスター。
  • ワーカーノードには 96 GB を超えるメモリーが必要です。
  • NFS 経由や、OpenShift Data Foundation、ローカルストレージなどのストレージが必要です。
    • このロールは、Trident ストレージコネクターを介して NetApp Filer へのアクセスを設定できます。
    • ローカルストレージは、ホストパスプロビジョナーを使用して設定されます。
  • KUBECONFIG 環境変数を kubeconfig に指定します。
  • 必要なパッケージ: このロールは、ansible-collection-kubernetes-core および python3-kubernetes パッケージを介してインストールできる kubernetes Ansible モジュールを使用します。
  • パス内に oc バイナリーが必要です。
  • Ansible からの community.sap_install collection

3.1.2. ロール変数

このロールで使用される変数を以下に示します。デフォルトは、sap_hypervisor_node_preconfigure/vars/platform_defaults_redhat_ocp_virt.yml ファイルに設定されています。

# Install and configure the host path provisioner (hpp) for a local storage disk
sap_hypervisor_node_preconfigure_install_hpp: False

# Install the trident NFS storage provider
sap_hypervisor_node_preconfigure_install_trident: False
# URL of the trident installer package to use
sap_hypervisor_node_preconfigure_install_trident_url: https://github.com/NetApp/trident/releases/download/v23.01.0/trident-installer-23.01.0.tar.gz

# should SRIOV be enabled for unsupported NICs
sap_hypervisor_node_preconfigure_sriov_enable_unsupported_nics: True

# Amount of memory [GB] to be reserved for the hypervisor on hosts >= 512GB
sap_hypervisor_node_preconfigure_hypervisor_reserved_ram_host_ge_512: 64 #GB
# Amount of memory [GB] to be reserved for the hypervisor on hosts < 512GB
sap_hypervisor_node_preconfigure_hypervisor_reserved_ram_host_lt_512: 32 #GB

# Should the check for the minimal amount of be ignored? Minimal amount is 96 GB
sap_hypervisor_node_preconfigure_ignore_minimal_memory_check: False

# Should the operators be installed
sap_hypervisor_node_preconfigure_install_operators: True

3.1.3. 設定変数

実際の要件に応じてクラスターを設定するには、次の変数構造を使用します。ベストプラクティスは、defaults/main.yml のコピーを作成し、ニーズに合わせてそれを調整する方法です。たとえば、最小バージョン (ホストパスプロビジョナーを使用) は次のようになります。

# Minimal configuration

sap_hypervisor_node_platform: redhat_ocp_virt
sap_hypervisor_node_preconfigure_install_hpp: True

sap_hypervisor_node_preconfigure_cluster_config:
  # URL under which the OpenShift cluster is reachable
  cluster_url: ocpcluster.domain.org

  # namespace under which the VMs are created, note this has to be
  # openshift-sriov-network-operator in case of using SRIOV network
  # devices
  vm_namespace: sap

  # CPU cores reserved for kubernetes on worker node
  worker_kubernetes_reserved_cpus: "0,1"

  # Storage device which should be used if host path provisioner is used
  worker_localstorage_device: /dev/sdb

  # detailed configuration for every worker that should be configured
  workers:
    - name: worker-0                   # name must match the node name
    - name: worker-1                   # second worker configuration

defaults/main.yml には、ネットワーク設定を含む完全な例があります。ご参照ください。

# ibmpower_phyp, redhat_ocp_virt, redhat_rhel_kvm, vmware_vsphere
sap_hypervisor_node_platform: redhat_ocp_virt

# sap_hypervisor_node_preconfigure_cluster_config.trident, see example config.
sap_hypervisor_node_preconfigure_install_trident: True|False

# should SRIOV be enabled for unsupported NICs
sap_hypervisor_node_preconfigure_sriov_enable_unsupported_nics: True|False

# Define if the host path provisioner should be installed in order to use a local disk as storage device.
# Uses the following variable to be set to the storage device to be used, e.g.:
# sap_hypervisor_node_preconfigure_cluster_config.worker_localstorage_device: /dev/sdb 
sap_hypervisor_node_preconfigure_install_hpp: True|False


# Example configuration
sap_hypervisor_node_preconfigure_cluster_config:

  # URL under which the OpenShift cluster is reachable
  cluster_url: ocpcluster.domain.org

  # namespace under which the VMs are created, note this has to be
  # openshift-sriov-network-operator in case of using SRIOV network
  # devices
  vm_namespace: sap

  # Optional, configuration for trident driver for Netapp NFS filer
  trident:
    management: management.domain.org
    data: datalif.netapp.domain.org
    svm: sap_svm
    backend: nas_backend
    aggregate: aggregate_Name
    username: admin
    password: xxxxx
    storage_driver: ontap-nas
    storage_prefix: ocpv_sap_

  # CPU cores reserved for kubernetes on worker node
  worker_kubernetes_reserved_cpus: "0,1"

  # Storage device which should be used if host path provisioner is used
  worker_localstorage_device: /dev/vdb

  # detailed configuration for every worker that should be configured
  workers:
    - name: worker-0                   # name must match the node name
      networks:                        # Example network config
        - name: sapbridge              # using a bridge
          description: SAP bridge
          state: up
          type: linux-bridge
          ipv4:
            enabled: false
            auto-gateway: false
            auto-dns: false
          bridge:
            options:
              stp:
                enabled: false
            port:
              - name: ens1f0           # network IF name
        - name: storage                # an SRIOV device
          interface: ens2f0            # network IF name
          type: sriov

        - bridge:                      # another bridge
            options:
              stp:
                enabled: false
            port:
              - name: ens2f0           # network IF name
          description: storage
          mtu: 9000
          ipv4:
            address:
              - ip: 192.168.1.51         # IP config
                prefix-length: 24
            auto-dns: false
            auto-gateway: false
          enabled: true
          name: storagebridge
          state: up
          type: linux-bridge
        - name: multi                  # another SRIOV device
          interface: ens2f1            # network IF name
          type: sriov

    - name: worker-1                   # second worker configuration
      networks:                        # Example network config
        - name: sapbridge              # using a bridge
          description: SAP bridge
          state: up
          type: linux-bridge
          ipv4:
            enabled: false
            auto-gateway: false
            auto-dns: false
          bridge:
            options:
              stp:
                enabled: false
            port:
              - name: ens1f0           # network IF name
        - name: storage                # an SRIOV device
          interface: ens2f0            # network IF name
          type: sriov

3.1.4. サンプル Playbook

ロールを呼び出すだけの簡単な Playbook については、この例を参照してください。これは、playbooks/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml ファイルにあります。

- hosts: all
  gather_facts: true
  serial: 1
  vars:
    sap_hypervisor_node_platform: redhat_ocp_virt
    sap_hypervisor_node_kubeconfig: "{{ lookup( 'ansible.builtin.env', 'KUBECONFIG') }}"
  environment:
    KUBECONFIG: "{{ sap_hypervisor_node_kubeconfig }}"
    K8S_AUTH_KUBECONFIG: "{{ sap_hypervisor_node_kubeconfig }}"
  roles:
    - { role: community.sap_install.sap_hypervisor_node_preconfigure }

3.1.5. Playbook の実行

例を実行するには、以下の手順に従います。

  1. クラスターの kubeconfig ファイルが環境変数を通じて使用できることを確認します。

    # export KUBECONFIG=path/to/kubeconfig
    
  2. Playbook のディレクトリーに移動します。

    # cd community.sap_install/playbooks
    
  3. 設定例で、ローカルホストを Ansible ホストとして使用してサンプル Playbook を呼び出すには、次のコマンドラインを使用します。

    # ansible-playbook -v --connection=local -i localhost,  sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml -e @<your copy of defaults/main.yml>
    

    OpenShift UI に Virtualization エントリーが表示されない場合は、ブラウザーのキャッシュをクリアする必要があります。

3.1.6. ストレージの設定

クラスターへの仮想マシンのインストールを続行するには、ストレージ接続を設定する必要があります。たとえば、以下を使用できます。

  • NFS (Trident を使用)
  • OpenShift Data Foundation
  • ローカルストレージ

NetApp Astra Trident を使用する NFS について、詳細は Configure a NetApp SVM to expose NFS for OpenShift Virtualization のブログを参照してください。NetApp の公式ドキュメントについては、Learn about Astra Trident installation を参照してください。OpenShift Data Foundation のセットアップを開始するには、Red Hat OpenShift Data Foundation を参照してください。

3.2 sap_create_vm ロールを使用して仮想マシンを作成する

https://github.com/newkitlabs/sap_create_vmsap_create_vm ロールを使用して、SAP のパフォーマンスチューニングを備えた仮想マシンを作成します。チューニングは次のとおりです。

  • 1G の hugepage
  • 専用 CPU の配置
  • NUMA CPU トポロジー (sap_create_vm_cores 変数、sap_create_vm_threads 変数、sap_create_vm_sockets 変数を参照してください)
  • オプション: SRIOV ネットワークインターフェイスを使用する

3.2.1. 要件

  • sap_hypervisor_preconfigure_role で設定された OpenShift Virtualization クラスター。
  • 十分なストレージスペースを備えたデフォルトのストレージクラスのセットアップ。
  • 以下のパッケージ:
    • python3-kubernetes
    • ansible-collection-kubernetes-core
      上記のパッケージは、次のコマンドでインストールできます。
# yum install python3-kubernetes ansible-collection-kubernetes-core

3.2.2. 変数

このロールで使用される変数は次のとおりです (vars/main.yml を参照)。

# Namespace the VMs are created in
sap_create_vm_namespace: sap

# Amount of memory [GB] the VM will have
sap_create_vm_memory: 32 # [GB]

######################################
# CPU Topology #######################
######################################
# The here defined virtual CPUs should be a subset of the physical CPUs.
# Ideally, the guest (VM) would have a full NUMA node (typically socket) minus two cores.
# E.g. a physical four socket host with 27 CPU cores (with 2 SMT threads)
# --> A guest with 25 CPU cores, 2 threads and 4 sockets. If the guest should be smaller, use less sockets.
# This settings will greatly effect performance.
#
# Number of CPU cores the VM will have
sap_create_vm_cores: 2

# Number of CPU threads
sap_create_vm_threads: 2

# Number of CPU sockets to use
sap_create_vm_sockets: 1

# Should the RHEL OS image be downloaded from Red Hat
sap_create_vm_download_rhel_images: true

# Version of the RHEL disk image to be downloaded and used as root disk, e.g. 8.6.0, 8.8.0
sap_create_vm_rhel_version: 8.8.0

# This amount of memory [GB] is reserved on top of the VM memory for the container to give it some headroom, only change with caution.
sap_create_vm_memory_overhead: 16 # [GB]

sap_create_vm_cloud_config:
      userData: >+
        #cloud-config

        user: cloud-user

        password: {{ sap_create_vm_cloud_user_passwd }}

        chpasswd:
          expire: false

        network:
          version: 2
          ethernets:
            eth0:
              dhcp4: true
# Networks the VM is attached to, see below for an example
# The OpenShift Virtualization cluster has to have the according NetworkAttachmentDefinitions and NetworkPolicies
sap_create_vm_networks: []

# Interfaces the VM has, see below for an example.
# The OpenShift Virtualization cluster has to have the according NetworkAttachmentDefinitions and NetworkPolicies
sap_create_vm_interfaces: []

以下は、ブリッジと 2 つの SRIOV ネットワークの例です。sap_create_vm_interfacessap_create_vm_networks を次のように設定します。

sap_create_vm_interfaces:
   - name: sapbridge-network-definition
     bridge: {}
     model: virtio
     networkInterfaceMultiqueue: true
   - name: storage-network-definition
     sriov: {}
   - name: multi-network-definition
      sriov: {}     

sap_create_vm_networks:
  - multus:
      networkName: sapbridge-network-definition
    name: sapbridge-network-definition
  - multus:
      networkName: iface-storage-sriov
    name: storage-network-definition
  - multus:
      networkName: iface-multi-sriov
    name: multi-network-definition

仮想マシンの既存ユーザー、パスワード、SSH キーなどの OS 設定は、sap_create_vm_cloud_config 変数を介して調整できます。現時点で、定義には新しい行が追加されている点に注意してください。cloud-init で何が設定できるかについて、詳細は Cloud-init のドキュメント を参照してください。

3.2.3. 仮想マシンのデプロイ

仮想マシンをデプロイするには、次の手順を実行します。

  1. 作業ディレクトリーで sap_create_vm ロールのチェックアウトを取得します。
  # git clone https://github.com/newkitlabs/sap_create_vm.git
  1. そのチェックアウトを Ansible パス内のディレクトリーに移動またはリンクします。例~/.ansible/roles が存在しない場合は、次のように作成します。
 # ln -sf ~/sap_create_vm/roles/sap_create_vm ~/.ansible/roles/
  1. 次のように、kubeconfig ファイルをエクスポートします。
  # export KUBECONFIG=$HOME/clusterconfigs-dciokd/kubeconfig 
  1. 次のコマンドを実行して、24 GB の RAM とパスワード MyS5perS3cureP@assW0rD を持つ sapvm01 という名前の仮想マシンを作成します。
# ansible-playbook -vvv --connection=local -i localhost,  playbooks/sap-create-vm.yml -e sap_create_vm_names="['sapvm01']" -e sap_create_vm_memory=24 -e sap_create_vm_cloud_user_passwd=MyS5perS3cureP@assW0rD
  1. sap_create_vm_rhel_version で指定された RHEL GA バージョン (例: 8.8.0) がダウンロードされます。イメージをダウンロードするかどうかは、sap_create_vm_download_rhel_images を介して制御できます。

4.SAP ワークロード用の OS 準備

community.sap_install リポジトリーから、sap_general_preconfigure ロールを使用して OS を適切に設定します。SAP HANA をインストールするには、追加で sap_hana_preconfigure ロールを使用し、次に sap_hana_install を使用します。Netweaver の場合は、sap_netweaver_preconfiguresap_swpm の順に使用します。

5.パフォーマンスに関するコメント

ベアメタルと OpenShift Virtualization 仮想マシンのパフォーマンスを比較すると、仮想マシンのパフォーマンスが低下していることがわかります。これは仮想化によって生じるオーバーヘッドによるもので、このような環境では珍しくありません。一部のテストはまったく影響を受けませんが、一部のテストに影響が見られます。

この影響は、作業負荷に大きく依存します。特定のmixed-olap/oltp シナリオでは、デルタは約 12% になります。

SAP HANA ベンチマークの SAP BW エディション (BWH) は、OpenShift Virtualization で実行すると約 5% の速度低下を示しました。

6.参考資料

Comments