雲端管理員可以利用 Google Cloud Platform (GCP) 外掛程式建立負載平衡器以支援自訂解決方案,包括高可用性。

您可以對負載平衡器組態的多個方面進行設定以支援特定需求。例如,這些功能可以支援為 SAP NetWeaver 和 SAP Hana 佈建基礎結構。透過此組態,可以在不同的可用性區域中部署不同的負載平衡器執行個體。

佈建負載平衡器之前,必須在 VMware Aria Automation 中設定適當的元件。
  • 如果沒有 GCP 雲端帳戶,請建立一個。
  • 設定類型模板和映像對應。
  • 建立預設網路設定檔。
  • 建立計算可用性區域並進行相應標記。透過這些標籤,您可以將執行個體和執行個體群組佈建到範本中的特定可用性區域。
完成這些步驟後,可以開啟 Automation Assembler 中的 設計索引標籤,建立範本。建置範本時,請考慮以下因素:
  • 範本應使用健全狀況檢查、執行個體、執行個體群組、後端服務、轉送規則和防火牆的規格對適當的負載平衡器組態進行建模。
  • 範本應指定虛擬機器及其部署所在的可用性區域。

設定內部 TCP 負載平衡器

下列範本顯示如何為購置設定內部 TCP 負載平衡器。若要部署此範本,您需要滿足以下條件:
  1. 網路
  2. 子網路 IP CIDR 範圍
  3. 內部負載平衡器的虛擬 IP (VIP) 位址

    這是您為轉送規則設定的位址。請參閱 Google Cloud 說明文件,瞭解如何為 NetWeaverSAP Hana 保留 IP 位址。

此範例範本使用配置協助程式為多個資源提供配置邏輯。該範本包含兩個執行個體、執行個體群組、一個健全狀況檢查資源、一個防火牆資源、一個後端服務資源和一個轉送規則資源。

部署此範本後,可以登入 Google Cloud 主控台,篩選並選擇要新增到執行個體群組的執行個體。只有與執行個體群組位於同一區域中的執行個體才會顯示為選項。請參閱 Google Cloud 主控台中的執行個體群組

formatVersion: 1
inputs:
  suffix:
    type: string
    title: ''
resources:
  Allocations_Image_1:
    type: Allocations.Image
    properties:
      image: ubuntu
  Allocations_Compute_1:
    type: Allocations.Compute
    properties:
      accountType: gcp
      constraints:
        - tag: zone-a
  Allocations_Compute_2:
    type: Allocations.Compute
    properties:
      constraints:
        - tag: zone-b
  Allocations_Flavor_1:
    type: Allocations.Flavor
    properties:
      flavor: medium
  Idem_GCP_COMPUTE_NETWORK_1:
    type: Idem.GCP.COMPUTE.NETWORK
    properties:
      name: network-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      auto_create_subnetworks: false
  Idem_GCP_COMPUTE_SUBNETWORK_1:
    type: Idem.GCP.COMPUTE.SUBNETWORK
    properties:
      name: subnetwork-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      network: ${Idem_GCP_COMPUTE_NETWORK_1.resource_id}
      region: ${resource.Allocations_Compute_1.selectedRegion.name}
      ip_cidr_range: '10.0.10.0/24'
  Idem_GCP_COMPUTE_INSTANCE_1:
    type: Idem.GCP.COMPUTE.INSTANCE
    properties:
      name: vm-doc-1-${input.suffix}
      zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      can_ip_forward: false
      project: ${resource.Allocations_Compute_1.selectedCloudAccount.additionalProperties.gcp.project}
      network_interfaces:
        - name: nic0
          stack_type: IPV4_ONLY
          subnetwork: ${Idem_GCP_COMPUTE_SUBNETWORK_1.resource_id}
      disks:
        - initialize_params:
            disk_name: disk-doc-boot-1-${input.suffix}
            source_image: ${resource.Allocations_Image_1.selectedImageId}
            disk_size_gb: 12
            disk_type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/diskTypes/pd-standard'}
          boot: true
          auto_delete: true
      machine_type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/machineTypes/' + resource.Allocations_Flavor_1.selectedInstanceTypeName}
      tags:
        items:
          - net-tag-1
          - net-tag-2
  Idem_GCP_COMPUTE_INSTANCE_2:
    type: Idem.GCP.COMPUTE.INSTANCE
    properties:
      name: vm-doc-2-${input.suffix}
      zone: ${resource.Allocations_Compute_2.selectedPlacementCompute.id}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      can_ip_forward: false
      project: ${resource.Allocations_Compute_1.selectedCloudAccount.additionalProperties.gcp.project}
      network_interfaces:
        - name: nic0
          stack_type: IPV4_ONLY
          subnetwork: ${Idem_GCP_COMPUTE_SUBNETWORK_1.resource_id}
      disks:
        - initialize_params:
            disk_name: disk-doc-boot-2-${input.suffix}
            source_image: ${resource.Allocations_Image_1.selectedImageId}
            disk_size_gb: 12
            disk_type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/diskTypes/pd-standard'}
          boot: true
          auto_delete: true
      machine_type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_2.selectedPlacementCompute.id + '/machineTypes/' + resource.Allocations_Flavor_1.selectedInstanceTypeName}
      tags:
        items:
          - net-tag-1
          - net-tag-2
  Idem_GCP_COMPUTE_INSTANCE_GROUP_1:
    type: Idem.GCP.COMPUTE.INSTANCE_GROUP
    properties:
      name: ig-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
      network: ${Idem_GCP_COMPUTE_NETWORK_1.resource_id}
  Idem_GCP_COMPUTE_INSTANCE_GROUP_2:
    type: Idem.GCP.COMPUTE.INSTANCE_GROUP
    properties:
      name: ig-doc-2-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      zone: ${resource.Allocations_Compute_2.selectedPlacementCompute.id}
      network: ${Idem_GCP_COMPUTE_NETWORK_1.resource_id}
  Idem_GCP_COMPUTE_HEALTH_CHECK_1:
    type: Idem.GCP.COMPUTE.HEALTH_CHECK
    properties:
      name: hc-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      type_: TCP
      check_interval_sec: 10
      timeout_sec: 10
      unhealthy_threshold: 2
      healthy_threshold: 2
      tcp_health_check:
        port: 80
        proxy_header: NONE
  Idem_GCP_COMPUTE_FIREWALL_1:
    type: Idem.GCP.COMPUTE.FIREWALL
    properties:
      name: f-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      network: ${Idem_GCP_COMPUTE_NETWORK_1.resource_id}
      direction: INGRESS
      target_tags:
        - net-tag-1
        - net-tag-2
      allowed:
        - ip_protocol: tcp
          ports:
            - ${resource.Idem_GCP_COMPUTE_HEALTH_CHECK_1.tcp_health_check.port}
  Idem_GCP_COMPUTE_BACKEND_SERVICE_1:
    type: Idem.GCP.COMPUTE.BACKEND_SERVICE
    properties:
      name: bs-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      health_checks:
        - ${resource.Idem_GCP_COMPUTE_HEALTH_CHECK_1.resource_id}
      load_balancing_scheme: INTERNAL
      region: ${resource.Allocations_Compute_1.selectedRegion.id}
      network: ${Idem_GCP_COMPUTE_NETWORK_1.resource_id}
      failover_policy:
        drop_traffic_if_unhealthy: true
        disable_connection_drain_on_failover: true
        failover_ratio: 1
      backends:
        - group: ${resource.Idem_GCP_COMPUTE_INSTANCE_GROUP_1.resource_id}
        - group: ${resource.Idem_GCP_COMPUTE_INSTANCE_GROUP_2.resource_id}
          failover: true
  Idem_GCP_COMPUTE_FORWARDING_RULE_1:
    type: Idem.GCP.COMPUTE.FORWARDING_RULE
    properties:
      ip_protocol: TCP
      name: fr-doc-1-${input.suffix}
      account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
      load_balancing_scheme: INTERNAL
      backend_service: ${resource.Idem_GCP_COMPUTE_BACKEND_SERVICE_1.resource_id}
      all_ports: true
      region: ${resource.Allocations_Compute_1.selectedRegion.id}
      subnetwork: ${Idem_GCP_COMPUTE_SUBNETWORK_1.resource_id}
      ip_address: '10.0.10.102'