Performs a manual switchover between the primary node and a read-only node of a specified PolarDB cluster.

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 Position Type Required Example Description
Action Query String No FailoverDBCluster

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

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

The ID of the PolarDB cluster.

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

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

Note If you do not specify this parameter, the system automatically selects the primary node. The system selects one or more nodes with the highest priorities from all the available read-only nodes. If the first read-only node fails to serve as the primary node due to network or replication failures, the system switches to the next available read-only node. This process continues until the switchover is completed.
ClientToken Query String No 6000170000591aed949d0f54a343f1a4233c1e7d1c5******

The client token that is used to ensure the idempotency of requests. If an API operation is idempotent, the API operation returns the same result for identical requests. You can use the client to generate the value. Make sure that the value is unique for different requests. The token is case-sensitive. The token can contain only ASCII characters and cannot exceed 64 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.