You can call this operation to manually switch between the primary and secondary nodes of an ApsaraDB for PolarDB cluster. A read-only node can be specified 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
DBClusterId String Yes pc-xxxxxxxxxxxxxxxx

The ID of the ApsaraDB for PolarDB cluster.

AccessKeyId String No key-test

The AccessKey ID provided to you by Alibaba Cloud.

Action String No FailoverDBCluster

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

ClientToken String No 6000170000591aed949d0f54a343f1a4233c1e7d1c5ca816bf

The client token that is used to ensure the idempotence of the request. You can use the client to generate this value, but you must ensure that it is unique among different requests. The token is case-sensitive. It can contain only ASCII characters, and cannot exceed 64 characters in length.

TargetDBNodeId String No pi-xxxxxxxxxx

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 node information such as the node ID.

Note Automatically select a primary node: The system selects one or more node with the highest priority from all the available read-only nodes. If the first node fails due to network or replication failure, the system switches to the next available node.

Response parameters

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

The ID of the request.

Examples

Sample requests


http(s)://[Endpoint]/? Action=FailoverDBCluster
&DBClusterId=pc-xxxxxxxxxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<FailoverDBClusterResponse>  
	    <RequestId>D0CEC6AC-7760-409A-A0D5-E6CD8660E9CC</RequestId>
</FailoverDBClusterResponse>

JSON format

{
	"RequestId":"D0CEC6AC-7760-409A-A0D5-E6CD8660E9CC"
}

Error codes

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