Creates a primary/secondary server group. A primary/secondary server group contains only two ECS instances: one functions as the primary server and the other one functions as the secondary server.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateMasterSlaveServerGroup |
The operation that you want to perform. Set the value to CreateMasterSlaveServerGroup. |
LoadBalancerId | String | Yes | lb-bp1hv944r69al4j****** |
The ID of the SLB instance. |
MasterSlaveBackendServers | String | Yes | [{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","ServerType":"Master","Description":"test-112" }, { "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","ServerType":"Slave","Description":"test-112" }] |
The list of backend servers in the primary/secondary server group. The value of this parameter is a JSON string in the JSON List structure. You can specify up to 20 elements in a JSON List for each request.
A primary/secondary server group can contain a maximum of two backend servers. If you do not set this parameter, an empty primary/secondary server group is created. Examples:
|
RegionId | String | Yes | cn-hangzhou |
The ID of the region where the SLB instance is created. |
MasterSlaveServerGroupName | String | No | Group1 |
The name of the primary/secondary server group. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
MasterSlaveServerGroupId | String | rsp-cige6j****** |
The ID of the primary/secondary server group. |
MasterSlaveBackendServers | Array of MasterSlaveBackendServer |
The list of backend servers in the primary/secondary server group. |
|
MasterSlaveBackendServer | |||
ServerId | String | vm-2h**** |
The ID of the ECS instance or ENI to be added. |
Port | Integer | 90 |
The port that is used by the backend server. |
Weight | Integer | 100 |
The weight of the backend server. |
ServerType | String | Slave |
The type of backend server. Valid values: Master and Slave. Default value: Slave. |
Description | String | The description of the primary/secondary server group. |
The description of the primary/secondary server group. |
Type | String | ecs |
The type of backend server. Valid values:
|
RequestId | String | 9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C |
The ID of the request. |
Examples
Sample request
http(s)://[Endpoint]/? Action=CreateMasterSlaveServerGroup
&LoadBalancerId=lb-bp1hv944r69al4j******
&MasterSlaveBackendServers=[{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","ServerType":"Master","Description":"test-112" }, { "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port":"80","ServerType":"Slave","Description":"test-112" }]
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML
format
<CreateMasterSlaveServerGroupResponse>
<RequestId>9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C</RequestId>
<MasterSlaveServerGroupId>rsp-cige******</MasterSlaveServerGroupId>
<MasterSlaveBackendServers>
<MasterSlaveBackendServers>
<ServerId>vm-gtgt***</ServerId>
<Port>80</Port>
<Weight>100</Weight>
<ServerType>Master</ServerType>
</MasterSlaveBackendServers>
<MasterSlaveBackendServers>
<ServerId>vm-tygtyg****</ServerId>
<Port>90</Port>
<Weight>100</Weight>
<ServerType>Slave</ServerType>
</MasterSlaveBackendServers>
</MasterSlaveBackendServers>
</CreateMasterSlaveServerGroupResponse>
JSON
format
{
"CreateMasterSlaveServerGroup": {
"RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C",
"MasterSlaveServerGroupId": "rsp-cige6*****",
"MasterSlaveBackendServers": {
"MasterSlaveBackendServers": [
{
"ServerId": "vm-hhhh****",
"Port": "80",
"Weight": "100",
"ServerType": "Master"
},
{
"ServerId": "vm-gggg***",
"Port": "90",
"Weight": "100",
"ServerType": "Slave"
}
]
}
}
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | BACKEND_SERVERS_NUM_MUST_BE_TWO | Backend servers num must be 2. | The error message returned because only two backend servers can be specified. |
400 | BACKEND_SERVERS_HAVE_SAME_PORT_AND_SERVERID | Backend servers have same port and serverId. | The error message returned because a backend server with the same port and server ID already exists. |
400 | BACKEND_SERVERS_CAN_ONLY_CONTAIN_ONE_MASTER_AND_ONE_SLAVE | Backend servers can only contain one master and one slave. | The error message returned because a primary/secondary server group can contain only one primary server and one secondary server. |
400 | BACKEND_SERVER_ID_CAN_NOT_EMPTY | Backend server id can not empty. | The error message returned because the backend server ID is required. |
400 | INVALID_SERVER_TYPE | Invalid server type. | The error message returned because the specified backend server type is invalid. |
400 | BACKEND_SERVER_PORT_CAN_NOT_EMPTY | Backend server port can not empty. | The error message returned because the port that is used by the backend server is required. |
400 | RealServerPortNotSupport | Real server port not support. | The error message returned because the port that is used by the backend server is invalid. |
For a list of error codes, visit the API Error Center.