This topic describes how to perform a switchover. A PolarDB cluster consists of one primary node and one or more read-only nodes. If a failure occurs on the primary node, the system can automatically perform a failover. You can also perform a manual switchover by promoting a read-only node to a new primary node. For example, if you need to test the high availability of a cluster or specify a read-only node to a primary node, you can perform a manual switchover.
A transient connection error may occur for approximately 30 seconds during a switchover in PolarDB clusters. We recommend that you perform the switchover during off-peak hours and make sure that your application can automatically reconnect to the PolarDB cluster.
- Log on to the PolarDB console.
- In the upper-left corner of the page, select the region where the PolarDB cluster
- Find the target cluster and click the cluster ID.
- On the Overview page, click Switch Primary Node in the Database Nodes section.
- In the Switch Primary Node dialog box, select a new primary node from the New Primary Node drop-down list and click OK.Note If you do not select a new primary node from the New Primary Node drop-down list, the system automatically promotes a read-only node that has the highest failover priority to the new primary node. A transient connection error may occur for approximately 30 seconds during a switchover. Make sure that your application can automatically reconnect to the cluster.
PolarDB clusters run in an active-active high-availability architecture. This architecture supports automatic failovers between the primary node and read-only nodes. The system automatically selects a new primary node.
Each node in a cluster has a failover priority. This priority determines the probability that the system promotes the node to the primary node if a failover occurs. If multiple nodes have the same failover priority, they all have the same probability of being promoted to the primary node.
The system performs the following steps to promote a read-only node to the primary node:
- Find all the read-only nodes that can be promoted to the primary node.
- Select one or more read-only nodes that have the highest failover priority.
- If the first node fails to be promoted to the primary node due to network or replication errors, the system attempts to promote the next available node. The system continues this process until the failover is successful.
Related API operations
|FailoverDBCluster||Performs a manual switchover by promoting a read-only node to a new primary node in your PolarDB cluster.|