PolarDB clusters automatically fail over to a read-only node when the primary node becomes unavailable. For planned maintenance or targeted node replacement, you can also trigger a failover manually by specifying the target node.
Usage notes
During a failover — whether automatic or manual — transient disconnections may occur. Each disconnection lasts 20–30 seconds. Make sure your application supports automatic reconnection to the cluster.
How automatic failover works
PolarDB clusters use an active-active architecture for high availability. When the primary node (which handles both reads and writes) becomes unavailable, the system automatically promotes a read-only node to become the new primary node.
Each node is assigned a failover priority. During a failover, the system selects the new primary node by following these steps:
-
Find all read-only nodes eligible for promotion.
-
From those nodes, select the ones with the highest failover priority.
-
Attempt to promote the first candidate. If it fails due to network or replication errors, try the next available node. The system continues until a promotion succeeds.
If multiple nodes share the same failover priority, each has an equal probability of being selected.
Perform a manual failover
Trigger a manual failover when you need to designate a specific read-only node as the new primary — for example, to replace the current primary node during planned maintenance.
Log on to the PolarDB console.
In the upper-left corner, select the region where the cluster is deployed.
Find the target cluster and click its ID.
-
On the Basic Information page, go to the Database Nodes section. In the upper-right corner of the section, click the
icon to switch the display mode. -
Click Fail Over.
-
In the dialog box that appears, select the target node from the New Primary Node drop-down list, then click OK.
API reference
| API | Description |
|---|---|
| FailoverDBCluster | Promotes a read-only node to primary in a PolarDB cluster. |