全部產品
Search
文件中心

Server Load Balancer:ModifyVServerGroupBackendServers - 替換虛擬伺服器組中的後端伺服器

更新時間:Dec 14, 2025

替換虛擬伺服器組中的後端伺服器。

介面說明

該介面只用於替換虛擬伺服器組中的後端伺服器,如果您需要修改後端伺服器的權重等配置,請參見 SetVServerGroupAttribute

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

slb:ModifyVServerGroupBackendServers

update

*instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

*loadbalancer

acs:slb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}

  • slb:tag
  • slb:tag

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

Server Load Balancer執行個體的地區 ID。

cn-hangzhou

VServerGroupId

string

伺服器組 ID。

rsp-cige6j****

OldBackendServers

string

要被替換的後端伺服器列表,包含以下參數:

  • ServerId:String 類型,必選,後端伺服器的執行個體 ID,分為 ECS 執行個體 ID、ENI 執行個體 ID 和 ECI 執行個體 ID,當 ServerId 參數值為 ENI 執行個體 ID 或 ECI 執行個體 ID 時,Type 參數值必選。

  • Weight:後端伺服器的權重,取值:0~100。預設值:100。 如果值為 0,則不會將請求轉寄給該後端伺服器。

  • Description:String 類型,非必選,後端伺服器描述,長度為 1~80 個字元,支援中文、字母、數字、短劃線(-)、正斜線(/)、半形句號(.)和底線(_)。

  • Type:後端伺服器類型,取值:

    • ecs:ECS 執行個體(預設)。

    • eni:彈性網卡執行個體。

    • eci:Elastic Container Instance。

說明

只有效能保障型執行個體支援添加 eni 和 eci 類型的後端伺服器。

  • ServerIp:ENI 或 ECI 的執行個體 IP。

  • Port:用來接收請求的後端連接埠。

樣本說明如下:

  • 掛載 ECS 樣本:

    [{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","Description":"test-112" }]

  • 掛載 ENI:

    [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" }]

  • 掛載 ENI 多 IP:

    [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-113" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]

  • 掛載 ECI:

    [{ "ServerId": "eci-xxxxxxxxx", "Weight": "100", "Type": "eci", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-114" }]

說明

必須是狀態為運行中的後端伺服器才可以加入Server Load Balancer執行個體,每次調用最多可添加 20 個後端伺服器。

[{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","Description":"test-112" }]

NewBackendServers

string

新的後端伺服器列表,包含以下參數:

  • ServerId:String 類型,必選,後端伺服器的執行個體 ID,分為 ECS 執行個體 ID、ENI 執行個體 ID 和 ECI 執行個體 ID,當 ServerId 參數值為 ENI 執行個體 ID 或 ECI 執行個體 ID 時,Type 參數值必選。

  • Weight:後端伺服器的權重,取值:0~100。預設值:100。 如果值為 0,則不會將請求轉寄給該後端伺服器。

  • Description:String 類型,非必選,後端伺服器描述,長度為 1~80 個字元,支援中文、字母、數字、短劃線(-)、正斜線(/)、半形句號(.)和底線(_)。

  • Type:後端伺服器類型,取值:

    • ecs:ECS 執行個體(預設)。

    • eni:彈性網卡執行個體。

    • eci:Elastic Container Instance。

說明

只有效能保障型執行個體支援添加 eni 和 eci 類型的後端伺服器。

  • ServerIp:ENI 或 ECI 的執行個體 IP。

  • Port:用來接收請求的後端連接埠。

樣本說明如下:

  • 掛載 ECS 樣本:

    [{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","Description":"test-112" }]

  • 掛載 ENI:

    [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" }]

  • 掛載 ENI 多 IP:

    [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-113" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]

  • 掛載 ECI:

    [{ "ServerId": "eci-xxxxxxxxx", "Weight": "100", "Type": "eci", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-114" }]

說明

必須是狀態為運行中的後端伺服器才可以加入Server Load Balancer執行個體,每次調用最多可添加 20 個後端伺服器。

[{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]

返回參數

名稱

類型

描述

樣本值

object

VServerGroupId

string

伺服器組 ID。

rsp-cige6j****

RequestId

string

請求 ID。

9DEC9C28-AB05-4DDF-9A78-6B08******

BackendServers

object

BackendServer

array<object>

後端伺服器列表。

object

後端伺服器列表。

Type

string

後端伺服器類型,取值:

  • ecs(預設):ECS 執行個體。

  • eni:彈性網卡執行個體。

  • eci:Elastic Container Instance。

ecs

Weight

integer

後端伺服器的權重。

100

Description

string

後端伺服器描述。

後端伺服器描述。

Port

integer

後端伺服器使用的連接埠。

70

ServerId

string

ECS 執行個體 ID 或 ENI 的執行個體 ID。

i-bp1ge5hrp****

樣本

正常返回樣本

JSON格式

{
  "VServerGroupId": "rsp-cige6j****",
  "RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08******",
  "BackendServers": {
    "BackendServer": [
      {
        "Type": "ecs",
        "Weight": 100,
        "Description": "後端伺服器描述。",
        "Port": 70,
        "ServerId": "i-bp1ge5hrp****"
      }
    ]
  }
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidParameter The specified BackendServers contain duplicated value of ServerID and Port. 指定的後端伺服器包含重複的服務ID和連接埠值。
400 Mismatched.ZoneId The zone of the server is not matched with the cloud box loadbalancer. 當前伺服器的可用性區域與雲盒執行個體可用性區域不匹配。
400 InvalidBackendServers.ServerIpConflict %s. 存在相同TunnelId和RsIp配置的後端伺服器。
400 OperationUnsupported.ModifyVServerGroupBackendServers This type of backend server is not allowed to attached to singleTunnel or anyTunnel lb. 這種類型的後端伺服器不允許附加到 singleTunnel 或 anyTunnel lb。
400 IncorrectStatus.RSByPassToas %s. 指定後端伺服器的BypassToa配置無效。
400 BackendServer.InvalidType The specified Type is invalid. 後端伺服器類型非法。
400 BackendServer.ServerRegionIdNotEqual The specified ServerRegionId must be equal. 後端伺服器必須屬於同一個地區。
400 OperationFailed.InvalidCen The cen related with this loadbalancer is invalid. 操作失敗,原因是指定Server Load Balancer執行個體關聯的Cen資訊缺失。
400 IncorrectStatus.CenNotAssociated The action is invalid because the loadbalancer is not associated with cen. 該操作無效,因為當前Server Load Balancer執行個體未與cen關聯。
400 InvalidBackendServers.MissingCenBandWidth The bandwidth is missing between loadbalancer and backendServers in cen. Cen中的Server Load Balancer執行個體所在的地區和掛載的目標地區之間要有頻寬包。
400 InvalidBackendServers.VpcNotInCen The BackendServers is not in the cen associated with the loadbalancer. 後端伺服器不在與負載平衡關聯的cen中。
400 InvalidServerId.NotExist The specified ServerId is not exist. 指定的後端伺服器不存在。
400 MissingParameter.ServerRegionId The parameter ServerRegionId is required. 參數ServerRegionId缺失。
400 MissingParameter.VbrId The parameter VbrId is required. 參數VbrId缺失。
400 InvalidParameter.ServerRegionId The parameter ServerRegionId is invalid for crossborder. 指定的ServerRegionId無效。請檢查參數約束,並在修改後重試。
400 InvalidVbrId.NotInCen The VbrId is not in the cen associated with the loadbalancer. 指定的Vbr不在執行個體關聯的Cen內。
400 InvalidParameter.ZoneNotSupport The zone does not support the parameter %s. 當前可用性區域不支援指定參數。
400 MasterSlaveServerConflict The servers are conflict for MasterSlaveGroup. 主備伺服器組的後端伺服器衝突。
400 NetworkConflict %s. 虛擬伺服器組和ECS配置資訊不一致。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情