Create an active/standby server group. An active/standby server group only contains two ECS instances. One is the active backend server and the other one is standby backend server.

Request parameters

Name Parameters Required Description
Action String  Yes The action to perform. Valid value:

CreateMasterSlaveServerGroup

RegionId String  Yes The ID of the region where the SLB instance is located.

You can obtain the region ID by calling the DescribeRegions API.

LoadBalancerId String Yes The ID of the Server Load Balancer instance.
MasterSlaveServerGroupName String  No The name of the active/standby server group.
MasterSlaveBackendServers List Yes A list of active/standby backend servers.

An active/standby server group can only contain two backend servers.

If you do not specify this parameter, an empty active/standby server group is created.

Table 1. MasterSlaveBackendServer
Name Parameters Required Description
ServerId String  Yes The ID of the ECS instance to add.
Port String  Yes The port used by the backend server.

Valid value: 1-65535

Weight String  Yes The weight of the backend server. Valid value: [0,100]

The default value is 100. If the value is 0, no requests will be forwarded to the backend server.

ServerType String  Yes The role of the backend server. Valid value:

Master (Default) | Slave

Type String  Yes The type of the backend server. Valid value:
  • ecs: ECS instance (Default)
  • eni: Elastic Network Interface (ENI)

Response parameters

Name Type Required
RequestId String The ID of the request.
MasterSlaveServerGroupId String The ID of the active/standby server group.
MasterSlaveBackendServers List A list of active/standby server groups.
Table 2. Masterslavebackendserver
Name  Type Required
ServerId String The ID of the ECS instance.
Port String The port used by the backend server.

Valid value: 1-65535

Weight String The weight of the backend server. Valid value: [0,100]

The default value is 100. If the value is 0, no requests will be forwarded to the backend server.

ServerType String The server type. Valid value:

Master (default) | Slave

Type String The type of the backend server. Valid value:
  • ecs: ECS instance (Default)
  • eni: Elastic Network Interface (ENI)

Examples

Request example

https://slb.aliyuncs.com/?Action=CreateMasterSlaveServerGroup
&RegionId=cn-hangzhou
&LoadBalancerId=lb-t4nj5vuz8ish9emfk1f20
&MasterSlaveServerGroupName=Group1
&MasterSlaveBackendServers=[
    {"ServerId":"vm-233","Port":"80","Weight":"100","ServerType":"Master"},
    {"ServerId":"vm-232","Port":"90","Weight":"100","ServerType":"Slave"},
&CommoParameters

Response example

  • XML format
    <? xml version="1.0" encoding="utf-8"? >
    <CreateMasterSlaveServerGroupResponse>
      <RequestId>9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C</RequestId>
      <MasterSlaveServerGroupId>rsp-cige6j5e7p</MasterSlaveServerGroupId>
      <MasterSlaveBackendServers>
          <MasterSlaveBackendServers>
              <ServerId>vm-233</ServerId>
              <Port>80</Port>
              <Weight>100</Weight>
              <ServerType>Master</ServerType>
          </MasterSlaveBackendServers>
          <MasterSlaveBackendServers>
              <ServerId>vm-232</ServerId>
              <Port>90</Port>
              <Weight>100</Weight>
              <ServerType>Slave</ServerType>
          </MasterSlaveBackendServers>
      </MasterSlaveBackendServers>
    </CreateMasterSlaveServerGroupResponse>
  • JSON format
    {
      "RequestId":"9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C",
      "MasterSlaveServerGroupId":"rsp-cige6j5e7p",
      "MasterSlaveBackendServers":{
          "MasterSlaveBackendServers":[
            {"ServerId":"vm-233","Port":"80","Weight":"100","ServerType":"Master"},
            {"ServerId":"vm-232","Port":"90","Weight":"100","ServerType":"Slave"},
          ]
        }
    }