更新服务器组的配置,例如健康检查、会话保持、名称、调度算法和协议等。
接口说明
UpdateServerGroupAttribute 接口属于异步接口,即系统返回一个请求 ID,但该服务器组的配置尚未更新成功,系统后台的更新任务仍在进行。您可以调用 ListServerGroups 查询服务器组的配置的更新状态:
当服务器组的配置处于 Configuring 状态时,表示服务器组的配置正在更新中。
当服务器组的配置处于 Available 状态时,表示服务器组的配置更新成功。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
alb:UpdateServerGroupAttribute |
update |
*ServerGroup
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ServerGroupName |
string |
否 |
服务器组名称。 长度为 2~128 个英文或中文字符,必须以大小字母或中文开头,可包含数字,半角句号(.),下划线(_)和短划线(-)。 |
test |
| Scheduler |
string |
否 |
调度算法。取值:
|
Wrr |
| ClientToken |
string |
否 |
客户端 Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。 说明
若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 可能不一样。 |
5A2CFF0E-5718-45B5-9D4D-70B3****** |
| DryRun |
boolean |
否 |
是否只预检此次请求,取值:
|
true |
| HealthCheckConfig |
object |
否 |
健康检查相关配置结构体。 |
|
| HealthCheckConnectPort |
integer |
否 |
健康检查的后端服务器的端口。 取值范围:0~65535。 设置为 0 时代表使用后端服务器的端口进行健康检查。 说明
当前服务器组 HealthCheckEnabled 为 true 时,该参数配置生效。 |
80 |
| HealthCheckEnabled |
boolean |
否 |
是否启用健康检查,取值:
|
true |
| HealthCheckHost |
string |
否 |
健康检查域名。
说明
只有 HealthCheckProtocol 设置为 HTTP、HTTPS 或 gRPC 时,该参数生效。 |
example.com |
| HealthCheckCodes |
array |
否 |
健康检查正常的状态码列表。 |
|
|
string |
否 |
健康检查正常的状态码。
说明
当前服务器组 HealthCheckEnabled 为 true 且 HealthCheckProtocol 设置为 HTTP 或 HTTPS 或 gRPC 时该参数生效。 |
200 |
|
| HealthCheckHttpVersion |
string |
否 |
健康检查 HTTP 协议版本。取值:
说明
当前服务器组 HealthCheckEnabled 为 true 且 HealthCheckProtocol 设置为 HTTP 或 HTTPS 时该参数生效。 |
HTTP1.1 |
| HealthCheckInterval |
integer |
否 |
健康检查的时间间隔。单位:秒。 取值范围:1~50。 说明
当前服务器组 HealthCheckEnabled 为 true 时,该参数配置生效。 |
5 |
| HealthCheckMethod |
string |
否 |
健康检查方法。取值:
说明
当前服务器组 HealthCheckEnabled 为 true 且 HealthCheckProtocol 设置为 HTTP 或 HTTPS 或 gRPC 时该参数生效。 |
HEAD |
| HealthCheckPath |
string |
否 |
健康检查的转发规则路径。 长度限制为 1~80,只能使用字母、数字、字符 说明
当前服务器组 HealthCheckEnabled 为 true 且 HealthCheckProtocol 设置为 HTTP 或 HTTPS 时该参数生效。 |
/test/index.html |
| HealthCheckProtocol |
string |
否 |
健康检查协议。取值:
|
HTTP |
| HealthCheckTimeout |
integer |
否 |
接收来自运行状况检查的响应需要等待的时间。如果后端 ECS 在指定的时间内没有正确响应,则判定为健康检查失败。单位:秒。 取值范围:1~300。 说明
当前服务器组 HealthCheckEnabled 为 true 时,该参数配置生效。 |
3 |
| HealthyThreshold |
integer |
否 |
健康检查连续成功多少次后,将后端服务器的健康检查状态由 fail 判定为 success。 取值范围:2~10。 |
4 |
| UnhealthyThreshold |
integer |
否 |
健康检查连续失败多少次后,将后端服务器的健康检查状态由 success 判定为 fail。 取值范围:2~10。 |
4 |
| StickySessionConfig |
object |
否 |
会话保持配置结构体 |
|
| Cookie |
string |
否 |
服务器上配置的 Cookie。 长度为 1~200 个字符,只能包含 ASCII 英文字母和数字字符,不能包含半角逗号(,)、半角分号(;)或空格,也不能以美元符号($)开头。 说明
当前服务器组 StickySessionEnabled 为 true 且 StickySessionType 配置为 Server 时,该参数生效。 |
B490B5EBF6F3CD402E515D22B****** |
| CookieTimeout |
integer |
否 |
Cookie 超时时间。单位:秒。 取值范围:1~86400。 说明
当前服务器组 StickySessionEnabled 为 true 且 StickySessionType 配置为 Insert 时,该参数生效。 |
1000 |
| StickySessionEnabled |
boolean |
否 |
是否启用会话保持。取值:
|
false |
| StickySessionType |
string |
否 |
Cookie 的处理方式。取值:
说明
当前服务器组 StickySessionEnabled 为 true 时,该参数生效。 |
Insert |
| ServerGroupId |
string |
是 |
服务器组 ID。 |
sgp-atstuj3rtop**** |
| UpstreamKeepaliveEnabled |
boolean |
否 |
是否开启后端长连接。
|
|
| ServiceName |
string |
否 |
仅适用于 ALB Ingress 场景,表示服务器组对应的 |
test2 |
| UchConfig |
object |
否 |
url 一致性 hash 参数配置。 |
|
| Type |
string |
是 |
参数类型。只支持输入 QueryString。 |
QueryString |
| Value |
string |
是 |
一致性 hash 参数值。 |
abc |
| ConnectionDrainConfig |
object |
否 |
连接优雅中断相关配置。 开启连接优雅中断,在移除后端服务器或者健康检查失败后,负载均衡使现有连接在一定时间内正常传输。 说明
|
|
| ConnectionDrainEnabled |
boolean |
否 |
是否开启连接优雅中断。
|
false |
| ConnectionDrainTimeout |
integer |
否 |
连接优雅中断超时时间。 取值范围:0~900。 |
300 |
| SlowStartConfig |
object |
否 |
慢启动相关配置。 开启慢启动后,将会在设定的时间段内对新添加到后端服务器组的后端服务器进行预热,转发到该服务器的请求数量线性增加。 说明
|
|
| SlowStartEnabled |
boolean |
否 |
是否开启慢启动。
|
false |
| SlowStartDuration |
integer |
否 |
慢启动持续时间。 取值范围:30~900。 |
30 |
| CrossZoneEnabled |
boolean |
否 |
服务器组是否开启跨 AZ 负载均衡。取值:
说明
|
true |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回数据结构组 |
||
| JobId |
string |
异步任务 ID。 |
72dcd26b-f12d-4c27-b3af-18f6aed5**** |
| RequestId |
string |
请求 ID。 |
365F4154-92F6-4AE4-92F8-7FF3***** |
示例
正常返回示例
JSON格式
{
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"RequestId": "365F4154-92F6-4AE4-92F8-7FF3*****"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | IncorrectStatus.ServerGroup | The status of %s [%s] is incorrect. | 服务器组状态无效。 |
| 400 | Mismatch.LoadBalancerEditionAndConnectionDrain | The %s and %s are mismatched. | 参数%s和%s不匹配。 |
| 400 | Mismatch.ServerGroupSchedulerAndSlowStartEnable | The %s and %s are mismatched. | 参数%s和%s不匹配。 |
| 400 | QuotaExceeded.ConnectionDrainTimeout | The quota of %s is exceeded, usage %s/%s. | 参数%s超过配额限制,当前值%s,配额值%s。 |
| 400 | UnsupportedFeature.ConnectionDrain | The feature of %s is not supported. | 不支持%s特性。 |
| 400 | QuotaExceeded.SlowStartDuration | The quota of %s is exceeded, usage %s/%s. | 参数%s超过配额限制,当前值%s,配额值%s。 |
| 400 | UnsupportedFeature.SlowStart | The feature of %s is not supported. | 不支持%s特性。 |
| 400 | Mismatch.LoadBalancerEditionAndSlowStartEnable | The %s and %s are mismatched. | 参数%s和%s不匹配。 |
| 400 | OperationDenied.UpstreamKeepaliveDisabled | The operation is not allowed because of UpstreamKeepaliveDisabled. | 不允许更新是否开启后端长连接为关闭状态 |
| 400 | OperationDenied.UpstreamKeepaliveEnabled | The operation is not allowed because of UpstreamKeepaliveEnabled. | 不允许更新是否开启后端长连接为开启状态 |
| 400 | CloseUpstreamKeepaliveNotSupport | The param of UpstreamKeepalive is not Support. | 不支持关闭服务器组的后端长链接 |
| 404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | 后端服务器组不存在。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。