Changing the Failover Priority of a Read Replica
Function
This API is used to change the failover priority of a read replica. Before calling this API:
- Learn how to authorize and authenticate it.
- Obtain the required region and endpoint.
URI
PUT /v3/{project_id}/instances/{instance_id}/nodes/{node_id}/priority
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
node_id |
Yes |
String |
Node ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. To obtain this value, call the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the token value. |
Content-Type |
Yes |
String |
Content type. Value: application/json |
X-Language |
No |
String |
Language. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
priority |
Yes |
String |
Failover priority. The value can be -1 or any number ranging from 1 to 16. If the value is a positive number, a smaller value indicates a higher priority. This priority determines the order in which read replicas are promoted when recovering from a primary node failure. Read replicas with the same priority have the same probability of being promoted to the new primary node. If the value is -1, the read replica does not participate in a failover. After the priority of a read replica is set to -1, ensure that a single-AZ instance still has at least one read replica or that the remaining nodes of a cross-AZ instance are in different AZs. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
job_id |
String |
Workflow ID. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Request
Changing the read replica failover priority to 2
PUT https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/61a4ea66210545909d74a05c27a7179ein07//nodes/ss62c18799854a919bab633874c159dfno01/priority { "priority" : 2 }
Example Response
Status code: 200
Success.
{ "job_id" : "b054f3e1-64f8-4219-ad48-f9ac494c6983" }
Status Code
Status Code |
Description |
---|---|
200 |
Success. |
400 |
Client error. |
500 |
Server error. |
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.