Updated on 2024-11-26 GMT+08:00

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

Table 1 Path Parameters

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

Table 2 Request body 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

Table 3 Response body parameters

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

Table 4 Response body parameters

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

Table 5 Response body parameters

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

Table 6 Response body parameters

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

Table 7 Response body parameters

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}/instances/{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.