Performs a manual switchover between the primary node and a read-only node of a specified PolarDB cluster. You can specify a read-only node as the new primary node.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No FailoverDBCluster

The operation that you want to perform. Set the value to FailoverDBCluster.

DBClusterId String Yes pc-**************

The ID of the database cluster.

TargetDBNodeId String No pi-***********

The ID of the node to be switched to the primary node. If you do not specify this parameter, the system automatically selects a node. You can call the DescribeDBClusters operation to query the information, such as the node ID.

Note If the system automatically selects the primary node, the system finds all the read-only nodes that can be selected. The system selects one or more read-only nodes that have the highest precedence from all the available read-only nodes. If the switch to the first node fails due to some reasons, such as network issues and replication status exceptions, the system tries to switch to the next available read-only node. This process continues until the switchover succeeds.
ClientToken String No 6000170000591aed949d0f54a343f1a4233c1e7d1c5******

Ensures the idempotence of requests to prevent duplicate requests from being submitted. This parameter value is generated by the client. Make sure that the value is unique among different requests. The token is case-sensitive, and cannot exceed 64 ASCII characters in length.

Response parameters

Parameter Type Example Description
RequestId String D0CEC6AC-7760-409A-A0D5-E6CD86******

The ID of the request.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/? Action=FailoverDBCluster
&DBClusterId=pc-**************
&<Common request parameters>

Sample success responses

XML format

<FailoverDBClusterResponse>
  <RequestId>D0CEC6AC-7760-409A-A0D5-E6CD86******</RequestId>
</FailoverDBClusterResponse>

JSON format

{
	"RequestId":"D0CEC6AC-7760-409A-A0D5-E6CD86******"
}

Error codes

For a list of error codes, visit the API Error Center.