You need to enable JavaScript to run this app.
导航

AddServerGroupBackendServers

最近更新时间2024.04.11 15:34:05

首次发布时间2021.08.31 10:37:27

调用 AddServerGroupBackendServers 接口为指定后端服务器组添加后端服务器。

使用说明

a.N.b类型参数中的N表示后端服务器的序号,取值范围为1 ~ 20,表示每调用一次接口最多可添加20台后端服务器。多个后端服务器之间使用“&”分隔。

调试

请求参数

名称类型是否必填示例值
描述
ActionStringAddServerGroupBackendServers要执行的操作,取值为AddServerGroupBackendServers。
VersionString2020-04-01API版本信息,当前版本为:2020-04-01。
ServerGroupIdStringrsp-bp1o94dp5i6ea****后端服务器组ID。您可以调用DescribeServerGroups接口获取后端服务器组ID。

Servers.N.InstanceId

String

Servers.1.InstanceId=i-3tkuehz8oa3vj0wz****&Servers.2.InstanceId=eni-2feo5qd3orri85oxruvxv****

后端服务器实例的ID或IP地址。您可以调用DescribeInstances接口获取“ecs”类型后端服务器ID,调用DescribeNetworkInterfaces接口获取“eni”类型后端服务器ID。

  • 后端服务器类型为“ecs”时,传入云服务器实例的ID。
  • 后端服务器类型为“eni”时,传入已绑定云服务器实例的网卡ID。
  • 后端服务器类型为“ip”时,传入后端服务器的IP地址。

Servers.N.Type

String

Servers.1.Type=ecs&Servers.2.Type=eni

后端服务器的类型,取值如下:

  • ecs:云服务器实例。
  • eni:网卡。
  • ip:IP地址。
  • 后端服务器组为“instance”类型且待添加的后端服务器为云服务器实例的主网卡时,后端服务器类型设置为“ecs”。
  • 待添加的后端服务器为云服务器绑定的辅助网卡时,后端服务器类型设置为“eni”。
  • 后端服务器组为IP类型时,后端服务器类型设置为“ip”。

说明

负载均衡支持添加IP地址作为后端服务器的功能正在邀测中,如需使用,请联系客户经理。

Servers.N.Weight

Integer

Servers.1.Weight=100&Servers.2.Weight=100

后端服务器的权重,取值范围为0 ~ 100。

  • 如果权重设置为0,表示不会将请求转发给该后端服务器。
  • 不传入该参数或该参数不传入数值时,默认为0。
Servers.N.IpStringServers.1.Ip=192.XX.XX.2&Servers.2.Ip=192.XX.XX.3后端服务器的私网IP地址。您可以调用DescribeInstances接口获取“ecs”类型后端服务器的私网IP地址,调用DescribeNetworkInterfaces接口获取“eni”类型后端服务器的私网IP地址。
Servers.N.PortIntegerServers.1.Port=88&Servers.2.Port=443后端服务器接收请求的端口号,取值范围为1~65535。

Servers.N.Description

String

Servers.1.Description=ecs1&Servers.2.Description=eni1

后端服务器的描述,默认值为空字符串。

  • 必须以字母、数字或中文开头,可包含字母、数字、中文及以下特殊字符:英文逗号(,)、点号(.)、下划线(_)、空格( )、等号(=)、中划线(-)、中文逗号(,)、中文句号(。)。
  • 长度限制为0~255个字符。

返回参数

字段类型示例值描述
RequestIdString20210811152539010225146063030****请求ID。
ServerIdsArray of String["rs-3cig8e5o0kxs06c6rrsqn****", "rs-3cig8e7n1ozr46c6rrsfn****"]后端服务器ID,为添加成功的后端服务器ID的集合。

请求示例

GET /?Action=AddServerGroupBackendServers&Version=2020-04-01&ServerGroupId=rsp-bp1o94dp5i6ea****&Servers.1.Description=ecs1&Servers.1.InstanceId=i-3tkuehz8oa3vj0wz****&Servers.1.Ip=192.XX.XX.2&Servers.1.Port=1&Servers.1.Type=ecs&Servers.1.Weight=100 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
Service: clb

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20210811152539010225146063030****",
        "Action": "AddServerGroupBackendServers",
        "Version": "2020-04-01",
        "Service": "clb",
        "Region": "cn-beijing"
    },
    "Result": {
        "RequestId": "20210811152539010225146063030****",
        "ServerIds": [
            "rs-3cig8e5o0kxs06c6rrsqn****"
        ]
    }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

HttpCode错误码错误信息描述

400

MissingParameter

The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, the 'XXX'.

该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如XXX

说明

其中,XXX表示缺少的参数名称。

400InvalidServers.Description.MalformedThe specified Servers.Description is malformed.指定的 Servers.Description 参数格式不合法。
400InvalidServers.Ip.MalformedThe specified Servers.Ip is malformed.指定的 Servers.Ip 参数格式不合法。
400InvalidServers.Port.MalformedThe specified Servers.Port is malformed.指定的 Servers.Port 参数格式不合法。
400InvalidServers.Type.MalformedThe specified Servers.Type is malformed.指定的 Servers.Type 参数格式不合法。
400InvalidServers.Weight.MalformedThe specified Servers.Weight is malformed.指定的 Servers.Weight 参数格式不合法。
400InvalidIncorrectOrder.MalformedThe specified index order is malformed.指定的索引顺序参数格式不合法。
400InvalidLoadBalancer.InvalidStatusThe specified LoadBalancer is not in the correct status for the request.指定的负载均衡所处状态无法响应该请求。
400InvalidServer.TypeThe specified Server type not match with ServerGroup.指定的后端服务器类型与服务器组类型不一致。
400UnsupportedOperation.AccountArrearsThe request on the specified instance is denied due to the account in arrears status.因账户处于欠费状态,对于该实例的操作请求被拒绝。
400LimitExceeded.ServerNumberYou've reached the limit on the number of add servers that you can operate.已达到单次可操作的后端服务器的数量上限。
400QuotaExceed.ServerNumberEachInstanceYou've reached the limit on the number of Servers that you can create.已达到可创建后端服务器的数量的配额上限。
400InvalidServerId.ServerIPMismatchThe specified serverIP and InstanceId are not matched.指定的后端服务器 ID 与 IP 不匹配。
400InvalidEni.UnSupportActionThe specified Eni does not support this action.指定的网卡不支持当前操作。
400InvalidBackendServer.ServerVpcMismatchThe specified BackendServer and Vpc are not matched.指定的后端服务器与 VPC 不匹配。
400InvalidServerIp.UnSupportActionThe specified Server Ip does not support this action.指定的后端服务器 IP 不支持当前操作。
403InvalidResourceType.ServcieManagedThe specified ResourceType is managed by a service.指定的资源是服务托管资源。
403ForbiddenYou are not authorized to perform operations on the specified service.无权限对指定服务进行操作。
404InvalidExclusiveCluster.NotFoundThe specified ExclusiveCluster does not exist.指定的独占集群不存在。
404InvalidServerGroup.NotFoundThe specified ServerGroup does not exist.指定的后端服务器组不存在。
404InvalidServer.NotFoundThe specified Server does not exist.指定的后端服务器不存在。
409InvalidServerPort.ConflictThe specified Server Port already exists.指定的后端服务器端口已存在。
409InvalidServer.ConflictThe specified Server already exists.指定的后端服务器已存在。
412InvalidLoadBalancer.ExpiredThe specified LoadBalancer has expired.指定的负载均衡已过期。
412InvalidExclusiveCluster.ExpiredThe specified ExclusiveCluster has expired.指定的独占集群已过期。
412InvalidExclusiveCluster.UnPurchasedThe specified ExclusiveCluster is not purchased.指定的独占集群未购买。