When a system failure occurs, a PolarDB cluster can automatically switch services from the primary node to a read-only node. You can specify a read-only node as the new primary node to switch services from the primary node to the read-only node.
Precautions
During an automatic failover or a manual failover, transient connections may occur. Each transient connection lasts 20s to 30s. Make sure that your applications can be automatically reconnected to the cluster.
Automatic failover
A PolarDB cluster of the Cluster Edition uses an active-active architecture that ensures high availability. If the primary node that supports reads and writes is faulty, services are automatically switched to the read-only node that is elected by the system as the new primary node.
A failover priority is assigned by the system to each node in a cluster. During a failover, a node is elected as the primary node based on the probability that is determined by this priority. The probability of being elected as the primary node is the same for the nodes that are assigned the same failover priority.
- Find all the available read-only nodes that can be elected as the primary node.
- Select the read-only nodes that are assigned the highest failover priority.
- If the failover to the first read-only node fails due to network issues, abnormal replication status, or other reasons, the system attempts to switch your services to another read-only node until the failover succeeds.
In the Database Nodes section of the Overview page for the cluster, you can view and configure the failover priority of each node in the cluster.

Manual failover
You can specify a read-only node as the new primary node to switch services from the primary node to the read-only node. Manual failovers are suitable for scenarios in which you need to test the high availability of a cluster or specify a read-only node as the primary node of a cluster.
Related API operations
Operation | Description |
---|---|
FailoverDBCluster | Manually switches services from the primary node to a read-only node of a specified PolarDB cluster. You can specify a read-only node as the new primary node. |