云管理员可以利用 Google Cloud Platform (GCP) 插件创建负载均衡器以支持自定义解决方案,包括高可用性。

您可以对负载均衡器配置的多个方面进行配置以支持特定要求。例如,这些功能可以支持 SAP NetWeaver 和 SAP Hana 的置备基础架构。通过此配置,您可以在不同的可用区中部署不同的负载均衡器实例。

置备负载均衡器之前,必须在 VMware Aria Automation 中设置适当的组件。
  • 创建 GCP 云帐户(如果没有)。
  • 设置特定实例和映像映射。
  • 创建默认网络配置文件。
  • 创建计算可用区并进行相应标记。通过这些标记,您可以将 实例和实例组置备到模板中的特定可用区。
完成这些步骤后,可以打开 Automation Assembler 中的 设计选项卡,创建模板。构建模板时,请考虑以下因素:
  • 模板应使用运行状况检查、实例、实例组、后端服务、转发规则和防火墙的规范对适当的负载均衡器配置进行建模。
  • 模板应指定虚拟机以及应在其中部署这些虚拟机的可用区。

设置内部 TCP 负载均衡器

以下模板说明了如何为 SAP 阿设置内部 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'