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 automatically performs 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 as 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.
- On the top of the page, select the region where the target cluster is located.
- Find the target cluster and click the cluster ID to go to the Overview page.
- In the upper-right corner of the Database Nodes section on the Overview page, click the icon to switch the display mode.
- Click Switch Primary Node.
- In the dialog box that appears, select a new primary node from the New Primary Node drop-down list and click OK.Notice A transient connection error may occur for approximately 30 seconds during a switchover. We recommend that you perform the switchover during off-peak hours and make sure that your application can automatically reconnect to the PolarDB 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 PolarDB 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 a PolarDB cluster.|