文档

ALIYUN::NLB::ServerGroup

更新时间:

ALIYUN::NLB::ServerGroup类型用于为网络型负载均衡创建服务器组。

语法

{
  "Type": "ALIYUN::NLB::ServerGroup",
  "Properties": {
    "ResourceGroupId": String,
    "Scheduler": String,
    "AddressIPVersion": String,
    "Servers": List,
    "PreserveClientIpEnabled": Boolean,
    "ServerGroupType": String,
    "PersistenceEnabled": Boolean,
    "ConnectionDrainEnabled": Boolean,
    "ConnectionDrainTimeout": Integer,
    "PersistenceTimeout": Integer,
    "VpcId": String,
    "HealthCheckConfig": Map,
    "Protocol": String,
    "ServerGroupName": String,
    "Tags": List,
    "AnyPortEnbaled": Boolean
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ResourceGroupId

String

资源组ID。

Scheduler

String

调度算法。

取值:

  • Wrr(默认值):加权轮询。权重值越高的后端服务器,被轮询到的概率也越高。

  • rr:轮询。按照访问顺序依次将外部请求分发到后端服务器。

  • sch:源IP哈希。相同的源地址会调度到相同的后端服务器。

  • tch:四元组哈希。基于四元组(源IP、目的IP、源端口和目的端口)的一致性哈希,相同的流会调度到相同的后端服务器。

  • qch:QUIC ID哈希。支持将同一个QUIC ID的请求哈希调度到同一台后端服务器上。

AddressIPVersion

String

协议版本。

取值:

  • ipv4(默认值):IPv4类型。

  • DualStack:双栈类型。

Servers

List

服务器列表。

更多信息,请参见Servers属性

PreserveClientIpEnabled

Boolean

是否开启客户端地址保持功能。

取值:

  • true:开启客户端地址保持功能。

  • false(默认值):关闭客户端地址保持功能。

ServerGroupType

String

服务器组类型。

取值:

  • Instance(默认值):服务器类型。该类型服务器组支持添加ECS、ENS、ECI类型实例。

  • Ip:IP地址类型。该类型服务器组支持直接添加IP地址类型的后端服务器。

PersistenceEnabled

Boolean

是否开启会话保持。

取值:

  • true:开启会话保持。

  • false:关闭会话保持。

ConnectionDrainEnabled

Boolean

是否开启连接优雅中断。

取值:

  • true:开启连接优雅中断。

  • false(默认值):关闭连接优雅中断。

ConnectionDrainTimeout

Integer

设置连接优雅中断超时时间。

单位:秒。

取值范围:10~900。

PersistenceTimeout

Integer

会话保持超时时间。

单位:秒。

取值范围:0~3600。

VpcId

String

服务器组所在VPC的ID。

说明

当ServerGroupType参数取值为Instance时,只有Instance类型服务器组所在VPC下的服务器,才可以加入到该服务器组中。

HealthCheckConfig

Map

健康检查相关配置。

更多信息,请参见HealthCheckConfig属性

Protocol

String

后端转发协议。

取值:

  • TCP(默认值)

  • UDP

  • TCPSSL

ServerGroupName

String

服务器组名称。

长度为2~128个字符,必须以大小写字母或中文开头,可包含数字、半角句号(.)、下划线(_)和短划线(-)。

AlpnEnabled

Boolean

是否启用Alpn代理。

取值:

  • true:启用。

  • false:不启用。

Tags

List

标签列表

更多信息,请参见ALIYUN::NLB::Listener

Servers语法

"Servers": [
  {
    "ServerType": String,
    "Description": String,
    "ServerId": String,
    "ServerIp": String,
    "Port": Integer,
    "Weight": Integer
  }
]

Servers属性

属性名称

类型

必须

允许更新

描述

约束

ServerType

String

后端服务器类型。

取值:

  • Ecs:ECS实例(默认)。

  • Eni:弹性网卡实例。

  • Eci:弹性容器实例。

  • Ip:服务IP。

Description

String

后端服务器描述。

ServerId

String

后端服务器的实例ID。

取值:

  • ECS实例ID。

  • ENI实例ID。

  • ECI实例ID。

说明

当ServerId参数值为ENI实例ID或ECI实例ID时,ServerType参数必选。

ServerIp

String

ECS、ENI或者ECI的实例IP。

Port

Integer

接收请求的后端端口。

Weight

Integer

后端服务器的权重。

取值:0~100。

默认值:100。

HealthCheckConfig语法

"HealthCheckConfig": {
  "HealthCheckInterval": Integer,
  "HealthCheckUrl": String,
  "HealthCheckConnectPort": Integer,
  "UnhealthyThreshold": Integer,
  "HttpCheckMethod": String,
  "HealthyThreshold": Integer,
  "HealthCheckConnectTimeout": Integer,
  "HealthCheckDomain": String,
  "HealthCheckEnabled": Boolean,
  "HealthCheckHttpCode": List,
  "HealthCheckType": String
}

HealthCheckConfig属性

属性名称

类型

必须

允许更新

描述

约束

HealthCheckInterval

Integer

健康检查的时间间隔。

单位:秒。

取值范围:5~50。

默认值:10。

HealthCheckUrl

String

健康检查路径。

长度为1~80个字符,只能使用字母、数字、字符(-/.%?#&=)以及扩展字符(_;~!()*[]@$^:',+),且必须以正斜线(/)开头。

说明

当HealthCheckType参数值为HTTP时,该参数生效。

HealthCheckConnectPort

Integer

健康检查的后端服务器的端口。

取值范围: 0~65535。

默认值:0,表示使用后端服务器的端口进行健康检查。

UnhealthyThreshold

Integer

健康检查连续失败多少次后,将后端服务器的健康检查状态由成功判定为失败。

取值范围:2~10。

默认值:2。

HttpCheckMethod

String

健康检查方法。

取值:

  • GET(默认值)

  • HEAD

说明

当HealthCheckType参数值为HTTP时,该参数生效。

HealthyThreshold

Integer

健康检查连续成功多少次后,将后端服务器的健康检查状态由失败判定为成功。

取值范围:2~10。

默认值:2。

HealthCheckConnectTimeout

Integer

健康检查响应的最大超时时间。

单位:秒。

取值范围:1~300。

默认值:5。

HealthCheckDomain

String

用于健康检查的域名。

取值:

  • $SERVER_IP:使用后端服务器内网IP。

  • domain:指定特定域名。长度限制1~80个字符,只能使用小写字母、数字、短划线(-)、半角句号(.)。

说明

当HealthCheckType参数值为HTTP时,该参数生效。

HealthCheckEnabled

Boolean

是否开启健康检查。

取值:

  • true(默认值):开启健康检查。

  • false:关闭健康检查。

HealthCheckHttpCode

List

健康状态返回码。

多个状态码用半角逗号(,)分隔。

取值:

  • http_2xx(默认值)

  • http_3xx

  • http_4xx

  • http_5xx

说明

当HealthCheckType参数值为HTTP时,该参数生效。

HealthCheckType

String

健康检查协议。

取值:

  • Tcp(默认值)

  • Http

Tags语法

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

Value

String

标签值。

返回值

Fn::GetAtt

ServerGroupId:服务器组ID。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcId:
    Type: String
    Description: ID of VPC
  HealthCheckConfig:
    Type: Json
    Description: Health Check Config
  ServerGroupName:
    Type: String
    Description: Name of ServerGroup
Resources:
  ExtensionResource:
    Type: ALIYUN::NLB::ServerGroup
    Properties:
      VpcId:
        Ref: VpcId
      HealthCheckConfig:
        Ref: HealthCheckConfig
      ServerGroupName:
        Ref: ServerGroupName
Outputs:
  ServerGroupId:
    Description: ID of ServerGroup
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ServerGroupId

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "Description": "ID of VPC"
    },
    "HealthCheckConfig": {
      "Type": "Json",
      "Description": "Health Check Config"
    },
    "ServerGroupName": {
      "Type": "String",
      "Description": "Name of ServerGroup"
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::NLB::ServerGroup",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "HealthCheckConfig": {
          "Ref": "HealthCheckConfig"
        },
        "ServerGroupName": {
          "Ref": "ServerGroupName"
        }
      }
    }
  },
  "Outputs": {
    "ServerGroupId": {
      "Description": "ID of ServerGroup",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ServerGroupId"
        ]
      }
    }
  }
}
  • 本页导读 (1)
文档反馈