Todos os produtos
Search
Central de documentação

Server Load Balancer:UpdateServerGroupAttribute

Última atualização: Oct 30, 2026

Atualiza as configurações de um grupo de servidores, como verificações de integridade, persistência de sessão, nome, algoritmo de agendamento e protocolo de verificação de integridade.

Descrição da operação

The UpdateServerGroupAttribute operation is asynchronous. After you send the request, the system returns a request ID, but the server group configurations are not immediately updated. The update task runs in the background. You can call the ListServerGroups operation to query the update status of the server group configurations:

  • If the server group configurations are in the Configuring state, the configurations are being updated.

  • If the server group configurations are in the Available state, the configurations are updated.

Experimente agora

Experimente esta API no OpenAPI Explorer, sem necessidade de assinatura manual. Chamadas bem-sucedidas geram automaticamente código SDK correspondente aos seus parâmetros. Faça o download com segurança de credenciais integrada para uso local.

Testar

Autorização RAM

A tabela abaixo descreve a autorização necessária para chamar esta API. Você pode defini-la em uma política do Resource Access Management (RAM). As colunas da tabela estão detalhadas abaixo:

  • Ação: As ações que podem ser usadas no elemento Action das instruções de política de permissão do RAM para conceder permissões para executar a operação.

  • API: A API que você pode chamar para executar a ação.

  • Nível de acesso: O nível de acesso predefinido concedido para cada API. Valores válidos: create, list, get, update e delete.

  • Tipo de recurso: O tipo de recurso que suporta autorização para executar a ação. Indica se a ação suporta permissão em nível de recurso. O recurso especificado deve ser compatível com a ação. Caso contrário, a política será ineficaz.

    • Para APIs com permissões em nível de recurso, os tipos de recursos obrigatórios são marcados com um asterisco (*). Especifique o Nome de Recurso Alibaba Cloud (ARN) correspondente no elemento Resource da política.

    • Para APIs sem permissões em nível de recurso, é exibido como Todos os Recursos. Use um asterisco (*) no elemento Resource da política.

  • Chave de condição: As chaves de condição definidas pelo serviço. A chave permite controle granular, aplicando-se somente a ações ou a ações associadas a recursos específicos. Além das chaves de condição específicas do serviço, o Alibaba Cloud fornece um conjunto de chaves de condição comuns aplicáveis a todos os serviços compatíveis com RAM.

  • Ação dependente: As ações dependentes necessárias para executar a ação. Para concluir a ação, o usuário RAM ou a função RAM deve ter permissões para executar todas as ações dependentes.

Ação

Nível de acesso

Tipo de recurso

Chave de condição

Ação dependente

alb:UpdateServerGroupAttribute

update

*ServerGroup.

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

Nenhuma Nenhuma

Parâmetros da solicitação

Parâmetro

Tipo

Obrigatório

Descrição

Exemplo

ServerGroupName

string

Não

O nome do grupo de servidores.

O nome deve ter entre 2 e 128 caracteres e pode conter letras, dígitos, pontos (.), sublinhados (_), hífens (-) e espaços. Ele deve começar com uma letra ou um dígito.

test

Scheduler

string

Não

The scheduling algorithm. Valid values:

  • Wrr: weighted round-robin. Backend servers with higher weights receive more requests.

  • Wlc: weighted least connections. Requests are distributed based on the weights and actual loads (number of connections) of backend servers. If backend servers have the same weight, the server with the fewest connections receives more requests.

  • Sch: consistent hashing. Requests with the same hash factor are scheduled to the same backend server. If the UchConfig parameter is not configured, the default hash factor is the source IP address, and requests from the same source IP address are distributed to the same backend server. If the UchConfig parameter is configured, the hash factor is the URL parameter, and requests with the same URL parameter are distributed to the same backend server.

Wrr

ClientToken

string

Não

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must ensure that it is unique among different requests. The client token can contain only ASCII characters.

Nota

If you do not specify this parameter, the system automatically uses the RequestId of the API request as the client token. The RequestId of each API request may be different.

5A2CFF0E-5718-45B5-9D4D-70B3******

DryRun

boolean

Não

Specifies whether to perform only a dry run. Valid values:

  • true: performs only a dry run and does not modify resources. The system checks the required parameters, request format, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.

  • false (default): performs a dry run and sends the actual request. If the request passes the dry run, an HTTP 2xx status code is returned and the operation is performed.

true

HealthCheckConfig

object

Não

A estrutura de configuração da verificação de integridade.

true

HealthCheckCodes

array

Não

A lista de códigos de status que indicam uma verificação de integridade bem-sucedida.

string

Não

The status codes that indicate a successful health check.

  • If HealthCheckProtocol is set to HTTP or HTTPS, valid values for HealthCheckCodes are http_2xx (default), http_3xx, http_4xx, and http_5xx. Separate multiple status codes with commas (,).

  • If HealthCheckProtocol is set to gRPC, valid values for HealthCheckCodes range from 0 to 99. Default value: 0. You can specify ranges. A maximum of 20 ranges are supported. Separate multiple ranges with commas (,).

Nota

This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP, HTTPS, or gRPC for the server group.

200

HealthCheckConnectPort

integer

Não

The port of the backend server that is used for health checks.

Valid values: 0 to 65535.

A value of 0 indicates that the port of the backend server is used for health checks.

Nota

The parameter settings take effect only when HealthCheckEnabled is set to true for the server group.

80

HealthCheckEnabled

boolean

Não

Specifies whether to enable health checks. Valid values:

  • true: enables health checks.

  • false: disables health checks.

true

HealthCheckHost

string

Não

The domain name that is used for health checks.

  • Internal IP address of the backend server (default): The internal IP address of the backend server is used as the domain name for health checks.

  • Custom domain name: Enter a domain name.

    • The domain name must be 1 to 80 characters in length.

    • It can contain lowercase letters, digits, hyphens (-), and periods (.).

    • It must contain at least one period (.), and the period (.) cannot be at the beginning or end.

    • The rightmost domain label can contain only letters, and cannot contain digits or hyphens (-).

    • The domain name cannot start or end with a hyphen (-).

Nota

This parameter takes effect only when HealthCheckProtocol is set to HTTP, HTTPS, or gRPC.

example.com

HealthCheckHttpVersion

string

Não

The HTTP version that is used for health checks. Valid values:

  • HTTP1.0

  • HTTP1.1

Nota

This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP or HTTPS for the server group.

HTTP1.1

HealthCheckInterval

integer

Não

The interval between two consecutive health checks. Unit: seconds.

Valid values: 1 to 50.

Nota

The parameter settings take effect only when HealthCheckEnabled is set to true for the server group.

5

HealthCheckMethod

string

Não

The HTTP method that is used for health checks. Valid values:

  • GET: If the length of the response message exceeds 8 KB, the message is truncated. However, the health check result is not affected.

  • POST: The POST method is used by default for gRPC listener health checks.

  • HEAD: The HEAD method is used by default for HTTP and HTTPS listener health checks.

Nota

This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP, HTTPS, or gRPC for the server group.

HEAD

HealthCheckPath

string

Não

The path that is used for health checks.

The path must be 1 to 80 characters in length, and can contain only letters, digits, the characters -/.%?#&=, and the extension characters _;~!()*[]@$^:',+. The path must start with a forward slash.

Nota

This parameter takes effect only when HealthCheckEnabled is set to true and the HealthCheckProtocol settings are HTTP or HTTPS for the server group.

/test/index.html

HealthCheckProtocol

string

Não

The protocol that is used for health checks. Valid values:

  • HTTP: sends HEAD or GET requests for browser impersonation to check whether the server application is healthy.

  • HTTPS: sends HEAD or GET requests for browser impersonation to check whether the server application is healthy. (Data encryption makes it more secure than HTTP.)

  • TCP: sends SYN handshake packets to check whether the server port is alive.

  • gRPC: sends POST or GET requests to check whether the server application is healthy.

HTTP

HealthCheckTimeout

integer

Não

The timeout period to accept a response from a health check. If the backend ECS instance does not respond correctly within the specified time, the health check is failed. Unit: seconds.

Valid values: 1 to 300.

Nota

The parameter settings take effect only when HealthCheckEnabled is set to true for the server group.

3

HealthyThreshold

integer

Não

The number of consecutive successful health checks that must occur before the health check status of a backend server changes from fail to success.

Valid values: 2 to 10.

4

UnhealthyThreshold

integer

Não

The number of consecutive failed health checks that must occur before the health check status of a backend server changes from success to fail.

Valid values: 2 to 10.

4

StickySessionConfig

object

Não

A estrutura de configuração da persistência de sessão.

Cookie

string

Não

The cookie configured on the server.

The cookie must be 1 to 200 characters in length, and can contain only ASCII letters and digits. It cannot contain commas (,), semicolons (;), or spaces, and cannot start with a dollar sign ($).

Nota

This parameter takes effect only when StickySessionEnabled is set to true and StickySessionType is set to Server for the server group.

B490B5EBF6F3CD402E515D22B******

CookieTimeout

integer

Não

The timeout period of the cookie. Unit: seconds.

Valid values: 1 to 86400.

Nota

This parameter takes effect only when StickySessionEnabled is set to true and StickySessionType is set to Insert for the server group.

1000

StickySessionEnabled

boolean

Não

Specifies whether to enable session persistence. Valid values:

  • true: enables session persistence.

  • false: disables session persistence.

false

StickySessionType

string

Não

The method that is used to handle cookies. Valid values:

  • Insert: inserts a cookie. When a client accesses the server for the first time, load balancing inserts a cookie (SERVERID) into the HTTP or HTTPS response. The next time the client accesses the server with this cookie, the load balancing service forwards the request to the recorded backend server.

  • Server: rewrites a cookie. When ALB detects a user-defined cookie, it rewrites the original cookie. The next time the client accesses the server with the new cookie, ALB forwards the request to the recorded backend server.

Nota

This parameter takes effect only when StickySessionEnabled is set to true for the server group.

Insert

ServerGroupId

string

Sim

O ID do grupo de servidores.

sgp-atstuj3rtop****

UpstreamKeepaliveEnabled

boolean

Não

Specifies whether to enable backend keep-alive. Valid values:

  • true: enables backend keep-alive.

  • false: disables backend keep-alive.

false

ServiceName

string

Não

This parameter is applicable only to ALB Ingress scenarios and specifies the name of the K8s Service that corresponds to the server group.

test2

UchConfig

object

Não

As configurações do parâmetro de hash consistente de URL.

Type

string

Sim

O tipo do parâmetro. Somente QueryString é suportado.

QueryString

Value

string

Sim

O valor do parâmetro de hash consistente.

abc

ConnectionDrainConfig

object

Não

The graceful connection break configuration.

After the graceful connection break is enabled, load balancing allows existing connections to be normally transmitted within a specified period after a backend server is removed or a health check is failed.

Nota
  • Basic Edition instances do not support connection draining. Only Standard Edition and WAF-enhanced Edition instances support this feature.

  • Server group types that support connection draining include server type and IP type. Function Compute type is not supported.

ConnectionDrainEnabled

boolean

Não

Specifies whether to enable connection draining. Valid values:

  • true: enables connection draining.

  • false: disables connection draining.

false

ConnectionDrainTimeout

integer

Não

The connection draining timeout period.

Valid values: 0 to 900.

300

SlowStartConfig

object

Não

The slow start configuration.

After slow start is enabled, newly added backend servers in the backend server group are warmed up within the specified time period, and the number of requests forwarded to the servers increases linearly.

Nota
  • Basic Edition instances do not support slow start. Only Standard Edition and WAF-enhanced Edition instances support this feature.

  • Server group types that support slow start include server type and IP type. Function Compute type is not supported.

  • Slow start can be enabled only when the backend scheduling algorithm is weighted round-robin polling.

SlowStartDuration

integer

Não

The slow start duration.

Valid values: 30 to 900.

30

SlowStartEnabled

boolean

Não

Specifies whether to enable slow start. Valid values:

  • true: enables slow start.

  • false: disables slow start.

false

CrossZoneEnabled

boolean

Não

Specifies whether to enable cross-zone load balancing for the server group. Valid values:

  • true: enables cross-zone load balancing (default).

  • false: disables cross-zone load balancing.

Nota
  • Basic Edition instances do not support server groups with cross-zone load balancing disabled. Only Standard Edition and WAF-enhanced Edition instances support this feature.

  • Server group types that support disabling cross-zone load balancing include server type and IP type. Function Compute type is not supported.

  • Session persistence cannot be enabled when cross-zone load balancing is disabled.

true

IpVersionAffinityMode

string

Não

The IP version affinity mode. Valid values:

  • NonAffinity (default): no affinity mode.

  • Affinity: affinity mode.

This parameter takes effect only when Ipv6Enabled is set to true.

Affinity

Elementos de resposta

Elemento

Tipo

Descrição

Exemplo

object

The response data structure.

JobId

string

O ID da tarefa assíncrona.

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

RequestId

string

The request ID.

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

Exemplos

Resposta de sucesso

JSON formato

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

Códigos de erro

Código de status HTTP

Código de erro

Mensagem de erro

Descrição

400 IncorrectStatus.ServerGroup The status of %s [%s] is incorrect. O status do grupo de servidores é inválido.
400 Mismatch.LoadBalancerEditionAndConnectionDrain The %s and %s are mismatched. Os parâmetros %s e %s não correspondem.
400 Mismatch.ServerGroupSchedulerAndSlowStartEnable The %s and %s are mismatched. Os parâmetros %s e %s não correspondem.
400 QuotaExceeded.ConnectionDrainTimeout The quota of %s is exceeded, usage %s/%s. O parâmetro %s excede o limite de cota. O valor atual é %s e o valor da cota é %s.
400 UnsupportedFeature.ConnectionDrain The feature of %s is not supported. O recurso %s não é suportado.
400 QuotaExceeded.SlowStartDuration The quota of %s is exceeded, usage %s/%s. O parâmetro %s excede o limite de cota. O valor atual é %s e o valor da cota é %s.
400 UnsupportedFeature.SlowStart The feature of %s is not supported. O recurso %s não é suportado.
400 Mismatch.LoadBalancerEditionAndSlowStartEnable The %s and %s are mismatched. Os parâmetros %s e %s não correspondem.
400 OperationDenied.UpstreamKeepaliveDisabled The operation is not allowed because of UpstreamKeepaliveDisabled. Não é permitido desativar conexões persistentes de backend.
400 OperationDenied.UpstreamKeepaliveEnabled The operation is not allowed because of UpstreamKeepaliveEnabled. Não é permitido atualizar conexões persistentes de backend para o status ativado.
400 CloseUpstreamKeepaliveNotSupport The param of UpstreamKeepalive is not Support. A desativação de conexões persistentes de back-end para o grupo de servidores não é suportada.
400 OperationDenied.VpcNotSupportIpv6 The operation is not allowed because of VpcNotSupportIpv6. A operação não é permitida porque o IPv6 não está ativado para a VPC atual.
400 OperationDenied.Ipv6ServerExists IPv6 backend servers exist in the specified server group. O grupo de servidores contém servidores de backend IPv6 e não pode ser alterado para IPv4.
404 ResourceNotFound.ServerGroup The specified resource %s is not found. O grupo de servidores de back-end não existe.

Consulte Códigos de Erro para uma lista completa.

Notas de versão

Consulte Notas de Versão para uma lista completa.