调用AddServersToServerGroup接口向应用型负载均衡服务器组中添加后端服务器。
使用说明
AddServersToServerGroup接口属于异步接口,即系统返回一个请求ID,但该后端服务器尚未添加成功,系统后台的添加任务仍在进行。
1. 您可以调用ListServerGroups查询服务器组的状态:
- 当服务器组处于Configuring状态时,表示服务器组正在变配中。
- 当服务器组处于Available状态时,表示服务器组运行中。
2. 您可以调用ListServerGroupServers查询后端服务器的状态:
- 当后端服务器处于Adding状态时,表示后端服务器正在加入服务器组。
- 当后端服务器处于Available状态时,表示后端服务器运行中。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AddServersToServerGroup |
要执行的操作。取值:AddServersToServerGroup。 |
ServerGroupId | String | 是 | sgp-atstuj3rtop**** |
服务器组ID。 |
Servers.N.Description | String | 否 | test |
后端服务器描述。长度为2~256个字符,支持中文和大小写英文字母,可包含数字、半角句号(.)、下划线(_)、短划线(-)、半角逗号(,)、半角分号(;)、正斜线(/)和at(@)。 单次调用最多支持添加40个服务器。 |
Servers.N.Port | Integer | 否 | 80 |
后端服务器使用的端口。取值范围:1~65535。 单次调用最多支持添加40个服务器。 说明 当ServerType取值为Ecs、Eni、Eci、Ip时,该参数必传。当ServerType取值为Fc时,无需配置该参数。
|
Servers.N.ServerId | String | 是 | ecs-bp67acfmxazb4p**** |
后端服务器ID。 单次调用最多支持添加40个服务器。
|
Servers.N.ServerIp | String | 否 | 192.168.1.1 |
ENI多IP模式时指定的IP地址。 单次调用最多支持添加40个服务器。 说明 ServerType取值为Fc时,无需配置该参数。
|
Servers.N.ServerType | String | 是 | Ecs |
后端服务器类型。 单次调用最多支持添加40个服务器。取值:
|
Servers.N.Weight | Integer | 否 | 100 |
后端服务器的权重,取值范围:0~100。默认值为100。如果设置权重为0,则不会将请求转发给该后端服务器。 单次调用最多支持添加40个服务器。 说明 ServerType取值为Fc时,无需配置该参数。
|
Servers.N.RemoteIpEnabled | Boolean | 否 | false |
是否开启远端IP功能。 单次调用最多支持添加40个服务器。取值:
目前支持远端IP功能的地域:华东1(杭州)、华南1(深圳)、华北1(青岛)、华北2(北京)、华北3(张家口)、华北6(乌兰察布)、华东2(上海)、西南1(成都)、华南3(广州)、中国香港、美国(弗吉尼亚)、日本(东京)、英国(伦敦)、美国(硅谷)、德国(法兰克福)、印度尼西亚(雅加达)、新加坡、马来西亚(吉隆坡)、澳大利亚(悉尼)、印度(孟买)。 说明 当ServerType取值为Ip时,该参数有效。
|
ClientToken | String | 否 | 593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3 |
客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样。
|
DryRun | Boolean | 否 | false |
是否只预检此次请求,取值:
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
JobId | String | 72dcd26b-f12d-4c27-b3af-18f6aed5**** |
异步任务ID。 |
RequestId | String | 365F4154-92F6-4AE4-92F8-7FF34B540710 |
请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=AddServersToServerGroup
&ServerGroupId=sgp-atstuj3rtop****
&Servers=[{"Description":"test","Port":80,"ServerId":"ecs-bp67acfmxazb4p****","ServerIp":"192.168.1.1","ServerType":"Ecs","Weight":100,"RemoteIpEnabled":false}]
&ClientToken=593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3
&DryRun=false
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<AddServersToServerGroupResponse>
<JobId>72dcd26b-f12d-4c27-b3af-18f6aed5****</JobId>
<RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
</AddServersToServerGroupResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"JobId" : "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"RequestId" : "365F4154-92F6-4AE4-92F8-7FF34B540710"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | ResourceQuotaExceeded.ServerAddedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | 配额%s已超额度限制,资源是%s,目前已使用%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. | %s冲突,已经存在同配置的%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中不匹配。 |
404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | 资源%s不存在。 |
404 | ResourceNotFound.Ecs | The specified resource %s is not found. | 资源%s不存在。 |
404 | ResourceNotFound.Eci | The specified resource %s is not found. | 资源%s不存在。 |
404 | ResourceNotFound.Eni | The specified resource %s is not found. | 资源%s不存在。 |
访问错误中心查看更多错误码。