All Products
Search
Document Center

PolarDB:Automatic and manual primary/secondary switchover

Last Updated:Mar 30, 2026

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:

  1. Find all read-only nodes eligible for promotion.

  2. From those nodes, select the ones with the highest failover priority.

  3. 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.

  1. Log on to the PolarDB console.

  2. In the upper-left corner, select the region where the cluster is deployed.

  3. Find the target cluster and click its ID.

  4. 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.

  5. Click Fail Over.

  6. 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.