Help Center/ GaussDB(for MySQL)/ API Reference/ APIs (Recommended)/ Instance Management/ Changing the Failover Priority of a Read Replica
Updated on 2024-09-11 GMT+08:00

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:

URI

PUT /v3/{project_id}/instances/{instance_id}/nodes/{node_id}/priority

Table 1 URI parameters

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

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

To obtain the value, call the 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.

Table 3 Request body parameter

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

Table 4 Response body parameter

Parameter

Type

Description

job_id

String

Workflow ID.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 6 Response body parameters

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.