AddServersToServerGroup - 添加后端服务器

向服务器组中添加后端服务器。

接口说明

AddServersToServerGroup 接口属于异步接口,即系统返回一个请求 ID,但该后端服务器尚未添加成功,系统后台的添加任务仍在进行。

  1. 您可以调用 ListServerGroups 查询服务器组的状态:

  • 当服务器组处于 Configuring 状态时,表示服务器组正在变配中。

  • 当服务器组处于 Available 状态时,表示服务器组运行中。

  1. 您可以调用 ListServerGroupServers 查询后端服务器的状态:

  • 当后端服务器处于 Adding 状态时,表示后端服务器正在加入服务器组。

  • 当后端服务器处于 Available 状态时,表示后端服务器运行中。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

alb:AddServersToServerGroup

create

*ServerGroup

acs:alb:{#regionId}:{#accountId}:servergroup/{#servergroupId}

Instance

acs:alb:{#regionId}:{#accountId}:ecs/{#InstanceId}

NetworkInterface

acs:alb:{#regionId}:{#accountId}:eni/{#NetworkInterfaceId}

ContainerGroup

acs:alb:{#regionId}:{#accountId}:eci/{#ContainerGroupId}

请求参数

名称

类型

必填

描述

示例值

ServerGroupId

string

服务器组 ID。

sgp-atstuj3rtop****

Servers

array

后端服务器列表, 单次调用最多支持添加 200 个服务器。

object

后端服务器组结构体。

Description

string

后端服务器描述。长度为 2~256 个英文或中文字符,不能以 http://和 https://开头。

test

Port

integer

后端服务器使用的端口。取值范围:1~65535。 单次调用最多支持添加 200 个服务器。

说明

ServerType 取值为 EcsEniEciIp 时,该参数必传。当 ServerType 取值为 Fc 时,无需配置该参数。

80

ServerId

string

后端服务器 ID。 单次调用最多支持添加 200 个服务器。

  • 当服务器组为 Instance 类型时,该参数为 EcsEniEci 的资源 Id。

  • 当服务器组为 Ip 类型时,该参数为 IP 地址。

  • 当服务器组为 Fc 时,该参数为函数计算的 ARN 标识。

i-uf616vu8me******

ServerIp

string

指定 IP 地址。 单次调用最多支持添加 200 个服务器。

ServerTypeEni 时,支持指定 ENI 的主私网 IP 或辅助私网 IP。

说明

ServerType 取值为 Fc 时,无需配置该参数。

192.168.1.1

ServerType

string

后端服务器类型。 单次调用最多支持添加 200 个服务器。取值:

  • Ecs:ECS 实例。

  • Eni:ENI 弹性网卡实例。

  • Eci:ECI 弹性容器。

  • Ip:IP 地址。

  • Fc:函数计算。

Ecs

Weight

integer

后端服务器的权重,取值范围:0~100。默认值为 100。如果设置权重为 0,则不会将请求转发给该后端服务器。 单次调用最多支持添加 200 个服务器。

说明

ServerType 取值为 Fc 时,无需配置该参数。

100

RemoteIpEnabled

boolean

是否开启远端 IP 功能。 单次调用最多支持添加 200 个服务器。取值:

  • true:开启。

  • false:不开启。

说明

ServerType 取值为 Ip 时,该参数有效。

false

ClientToken

string

客户端 Token,用于保证请求的幂等性。

从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。

说明

若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。

593B0448-D13E-4C56-AC0D-FDF0******

DryRun

boolean

是否只预检此次请求,取值:

  • true:发送检查请求,不会向服务器组中添加后端服务器。检查项包括是否填写了必需参数、请求格式、业务限制。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation

  • false(默认值):发送正常请求,通过检查后返回 HTTP 2xx 状态码并直接进行操作。

false

返回参数

名称

类型

描述

示例值

object

返回数据结构体

JobId

string

异步任务 ID。

72dcd26b-f12d-4c27-b3af-18f6aed5****

RequestId

string

请求 ID。

365F4154-92F6-4AE4-92F8-7FF34******

示例

正常返回示例

JSON格式

{
  "JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****",
  "RequestId": "365F4154-92F6-4AE4-92F8-7FF34******"
}

错误码

HTTP status code

错误码

错误信息

描述

400 ResourceQuotaExceeded.ServerAddedNum The quota of %s is exceeded for resource %s, usage %s/%s. 服务器添加到组已超额度限制。
400 IncorrectStatus.ServerGroup The status of %s [%s] is incorrect. 服务器组状态无效。
400 Conflict.BackendServer There is already %s having the same configuration with %s. 服务器冲突,已经存在同配置的后端服务器。
400 OperationDenied.VpcVportNotFound The operation is not allowed because of %s. 不允许该操作,原因:vpc端口未找到
400 IncorrectStatus.Eni The status of %s [%s] is incorrect. 资源%s [%s]的状态无效。
400 ResourceInUse.IP The specified resource %s is in use. 资源%s正在使用中。
400 OperationDenied.NoAvailableVSwitch The operation is not allowed because of %s. 操作被拒绝,原因是%s。
400 OperationDenied.VgwVipNotFound The operation is not allowed because of %s. 操作被拒绝,原因是%s。
400 OperationDenied.CloudBox The operation is not allowed because of %s. 操作被拒绝,原因是%s。
400 Mismatch.Type The %s is mismatched for %s and %s. %s在%s和%s中不匹配。
400 Mismatch.VpcId The %s is mismatched for %s and %s. %s在%s和%s中不匹配。
400 ResourceQuotaExceeded.LoadBalancerServersNum The quota of %s is exceeded for resource %s, usage %s/%s. 后端服务器数已超额度限制。
400 ResourceInConfiguring The specified resource of %s is being configured. Please try again later. 指定的资源在变更中,请稍后再试
400 DuplicatedParam.BackendServer The param of %s is duplicated. 参数%s是重复的。
400 OperationDenied.EciNotSupportJobType The operation is not allowed because of eci not support job type. 服务器组不支持添加Job优化型ECI实例。
400 IllegalParam.ServerIp The param of ServerIp is illegal. 参数ServerIp非法
400 Mismatch.ServerType The %s is mismatched for %s and %s. %s在%s和%s中不匹配。
400 ServiceUnavailable The request has failed due to a temporary failure of the server. 请求因服务器暂时性故障而失败。
403 Forbidden.ServerGroup Authentication has failed for ServerGroup. ServerGroup鉴权失败
404 ResourceNotFound.ServerGroup The specified resource %s is not found. 后端服务器组不存在。
404 ResourceNotFound.Ecs The specified resource %s is not found. Ecs服务器不存在。
404 ResourceNotFound.Eci The specified resource %s is not found. Eci服务器不存在。
404 ResourceNotFound.Eni The specified resource %s is not found. 资源%s不存在。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情