Performs a failover between the primary node and a read-only node in a 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 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 PolarDB cluster.

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

The ID of the read-only node that serves as the new primary node. If you leave this parameter empty, the system automatically selects a read-only node. You can call the DescribeDBClusters operation to query node information, such as node IDs.

Note
  • If you leave this parameter empty, the system selects one or more nodes that have the highest priority from all the available read-only nodes. If the failover to the first read-only node fails due to network issues, abnormal replication status, or other reasons, the system tries to switch to another read-only node until the failover succeeds.
  • If the database engine of the PolarDB cluster is PolarDB O Edition or the ApsaraDB PolarDB PostgreSQL-compatible edition, this parameter is required. If the database engine of the PolarDB cluster is the ApsaraDB PolarDB MySQL-compatible edition, this parameter is optional.
ClientToken String No 6000170000591aed949d0f54a343f1a4233c1e7d1c5******

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

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

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

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