向网络型负载均衡服务器组中添加后端服务器。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
nlb:AddServersToServerGroup |
create |
*ServerGroup
Instance
NetworkInterface
ContainerGroup
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ServerGroupId |
string |
是 |
服务器组 ID。 |
sgp-atstuj3rtoptyui**** |
| Servers |
array<object> |
是 |
后端服务器列表。 说明
单次调用最多支持传入 200 个服务器。 |
|
|
object |
否 |
后端服务器列表。 说明
单次调用最多支持传入 200 个服务器。 |
||
| ServerId |
string |
是 |
后端服务器 ID。
|
i-bp67acfmxazb4p**** |
| ServerType |
string |
是 |
后端服务器类型,取值:
|
Ecs |
| ServerIp |
string |
否 |
服务器 IP 地址。当服务器组为 Ip 类型时,必须指定 IP 地址。 |
192.168.6.6 |
| Port |
integer |
否 |
后端服务器使用的端口。端口范围0~65535,不填则默认传入端口值 0。 当服务器组开启全端口转发后,添加后端服务器时无需指定端口(默认传入 0),NLB 将按照前端请求端口转发流量至后端服务器。您可以通过 ListServerGroups 接口返回的 AnyPortEnabled 字段查询是否开启了全端口转发。 |
443 |
| Weight |
integer |
否 |
后端服务器的权重,取值范围:0~100。默认值为 100。如果设置权重为 0,则不会将请求转发给该后端服务器。 |
100 |
| Description |
string |
否 |
服务器描述信息。 长度限制为 2-256 个字符,可包含英文字母、数字、中文、半角逗号(,)、半角句号(.)、半角分号(;)、正斜线(/)、at(@)、下划线(_)和短划线(-)。 |
ECS |
| RegionId |
string |
否 |
网络型负载均衡实例所在的地域 ID。 您可以通过调用 DescribeRegions 接口获取地域 ID。 |
cn-hangzhou |
| DryRun |
boolean |
否 |
是否只预检此次请求。取值:
|
false |
| ClientToken |
string |
否 |
客户端 Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。 说明
若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 可能不一样。 |
123e4567-e89b-12d3-a456-426655440000 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
添加后端服务器。 |
||
| RequestId |
string |
请求 ID。 |
54B48E3D-DF70-471B-AA93-08E683A1B45 |
| ServerGroupId |
string |
服务器组 ID。 |
sgp-atstuj3rtoptyui**** |
| JobId |
string |
异步任务 ID。 |
72dcd26b-f12d-4c27-b3af-18f6aed5**** |
示例
正常返回示例
JSON格式
{
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45",
"ServerGroupId": "sgp-atstuj3rtoptyui****",
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | Conflict.Lock | The Lock [%s] is conflict. | 指定的资源当前存在锁冲突。 |
| 400 | IllegalParam.IP | The param of IP is illegal. | 参数IP非法。请检查参数IP的输入值。 |
| 400 | QuotaExceeded.QuotaInsufficient | The quota of %s is exceeded, usage %s/%s. | 配额不足,已使用%s/%s。请在配额中心中修改配额大小。 |
| 400 | SystemBusy | System is busy, please try again later. | 系统繁忙,请稍后重试 |
| 400 | DuplicatedParam.Server | The param of Server is duplicated. | 参数中的server重复了。 |
| 400 | IncorrectStatus.serverGroup | The status of servergroup [%s] is incorrect. | 服务器组的状态无法进行当前操作,请检查服务器组当前是否处于其他操作下。 |
| 400 | Mismatch.VpcId | The VpcId is mismatched for %s and %s. | 资源%s和资源%s的VpcId不匹配。请检查两种资源是否在同一个VPC下。 |
| 400 | Mismatch.ServerType | The ServerType is mismatched for %s and %s. | ServerType不匹配 |
| 400 | IllegalParam.RSPortConflictWithServerGroup | The param of RSPortConflictWithServerGroup is illegal. | 参数RSPort与ServerGroup冲突。请检查输入值。 |
| 400 | TagInvokeError | listTagsByResourceIds: InvalidResourceId.NotFound : The specified ResourceIds are not found in our records. | 在资源标签中找不到资源定义,请检查RAM是否给NLB添加授权。 |
| 400 | ResourceInUse.IP | The specified resource of IP is in use. | 传入的IP不能是NLB的eni地址,请检查参数。 |
| 400 | IllegalParam | The param of %s is illegal. | 输入的参数有值非法,请检查输入。 |
| 400 | MissingParam.%s | The parameter of %s is missing. | 参数%s缺失,请检查输入参数。 |
| 400 | IllegalParam.description | The parameter description of server is illegal. | 服务器描述不符合输入要求,请根据错误中的详细信息进行修改。 |
| 400 | MissingParam.IP | The param of IP is missing. | 输入的IP参数缺失,请检查您的输入参数。 |
| 400 | OperationDenied.ServerGroupNotSupportIpv6 | The operation is not allowed because of ServerGroupNotSupportIpv6. | 因为服务器组不支持IPV6,所以操作失败。 |
| 400 | IncorrectStatus.Eni | Eni status is invalid. | 弹性网卡状态不合法。 |
| 400 | IdempotenceSignatureMismatch | The idempotence token of request is same with the prev one, but the signature is different. | 请求的幂等令牌与上一个相同,但签名不同。 |
| 400 | Throttling.User | Request was denied due to api flow control. | 由于触发流控,请求被拒绝。 |
| 403 | Forbidden.NoPermission | Authentication is failed for NoPermission. | 因为账号没有权限,所以鉴权失败。 |
| 404 | ResourceNotFound.serverGroup | The specified resource of serverGroup is not found. | 找不到指定的服务器组资源,请检查输入参数。 |
| 404 | ResourceNotFound.Eci | The specified resource of Eci is not found. | 找不到指定的弹性容器实例(Eci)资源,请检查输入的参数。 |
| 404 | ResourceNotFound.Ecs | The specified resource of Ecs is not found. | 找不到指定的ECS资源, 请检查输入的参数。 |
| 404 | ResourceNotFound.Eni | The specified resource Eni is not found. | 没有找到指定的弹性网卡实例,请检查输入参数。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。