Configuring Replica Priority¶
Function¶
This API is used to configure the replica priority. When the master node is faulty, a replica with a smaller weight has a higher priority to be promoted to master.
URI¶
POST /v2/{project_id}/instances/{instance_id}/groups/{group_id}/replications/{node_id}/slave-priority
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details, see Obtaining a Project ID. |
instance_id | Yes | String | Instance ID. |
group_id | Yes | String | Shard ID. |
node_id | Yes | String | Node ID. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
slave_priority_weight | Yes | Integer | Replica priority. The value ranges from 0 to 100. Value 0 indicates that the promotion is disabled by default. |
Response Parameters¶
Status code: 400
Parameter | Type | Description |
---|---|---|
error_msg | String | Error message. Maximum: 1024 |
error_code | String | Error code. Maximum: 9 |
error_ext_msg | String | Extended error information. This parameter is not used currently and is set to null. Maximum: 1024 |
Status code: 401
Parameter | Type | Description |
---|---|---|
error_msg | String | Error message. Maximum: 1024 |
error_code | String | Error code. Maximum: 9 |
error_ext_msg | String | Extended error information. This parameter is not used currently and is set to null. Maximum: 1024 |
Status code: 403
Parameter | Type | Description |
---|---|---|
error_msg | String | Error message. Maximum: 1024 |
error_code | String | Error code. Maximum: 9 |
error_ext_msg | String | Extended error information. This parameter is not used currently and is set to null. Maximum: 1024 |
Status code: 404
Parameter | Type | Description |
---|---|---|
error_msg | String | Error message. Maximum: 1024 |
error_code | String | Error code. Maximum: 9 |
error_ext_msg | String | Extended error information. This parameter is not used currently and is set to null. Maximum: 1024 |
Status code: 500
Parameter | Type | Description |
---|---|---|
error_msg | String | Error message. Maximum: 1024 |
error_code | String | Error code. Maximum: 9 |
error_ext_msg | String | Extended error information. This parameter is not used currently and is set to null. Maximum: 1024 |
Example Requests¶
Setting the replica priority to 100
POST https://{dcs_endpoint}/v2/{project_id}/instance/{instance_id}/groups/{group_id}/replications/{node_id}/slave-priority
{
"slave_priority_weight" : 100
}
Example Responses¶
None
Status Codes¶
Status Code | Description |
---|---|
204 | Replica priority configured successfully. |
400 | Invalid request. |
401 | Invalid authentication information. |
403 | The request is rejected. |
404 | The requested resource is not found. |
500 | Internal service error. |
Error Codes¶
See Error Codes.