A PolarDB Cluster Edition cluster consists of multiple nodes. One of the nodes is a primary node and the other nodes are read-only nodes. The system can automatically switch over services from the primary node to a read-only node in the event of a system failure. Alternatively, you can perform a manual switchover by specifying a read-only node as 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.
Only PolarDB Cluster Edition supports the primary/secondary switchover feature. Single Node and Archive Database do not support the primary/secondary switchover feature. For more information about feature comparison among the editions, see Product editions.
Manually switch over services between primary and read-only nodes
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region where the cluster resides.
- Find the cluster, and then click the cluster ID.
- In the Database Nodes section on the Overview page, click the icon in the upper-right corner to switch views.
- Click Switch Primary Node.
- In the dialog box that appears, specify New Primary Node and click OK.Note If you do not specify New Primary Node, the system automatically elects the read-only node that has the highest failover priority as the primary node for the switchover. A transient connection error may last for approximately 30 seconds during the switchover. Make sure that your application can automatically reconnect to the cluster.
Automatically switch over services between primary and read-only nodes
PolarDB uses an active-active high-availability cluster architecture. This architecture supports automatic failovers between the primary node that supports reads and writes and the read-only nodes. The system automatically elects a new primary node.
Each node in a PolarDB cluster has a failover priority. This priority determines the probability at which a node is elected as the primary node during a failover. If multiple nodes have the same failover priority, they all have the same probability of being elected as the primary node.
- Find all the read-only nodes that can be elected as the primary node.
- Select one or more read-only nodes that have the highest failover priority.
- If the failover to the first node fails due to reasons, such as network issues and abnormal replication status, the system tries to switch to another node until the failover succeeds.
Related API operations
|FailoverDBCluster||Manually switches over services between the primary node and a read-only node in a PolarDB cluster. You can specify a read-only node as the new primary node.|