When a system failure occurs, a PolarDB cluster can automatically switch over services from the primary node to a read-only node. You can also perform a manual switchover by specifying a read-only node as a new primary node.
Automatically switch over services between primary and read-only nodes
A PolarDB cluster of Cluster Edition uses an active-active cluster architecture that has high availability. 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 state, the system attempts to switch to another 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.
Manually switch over services between primary and read-only nodes
You can also 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.
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region where the cluster is deployed.
- Find the cluster and click the cluster ID.
- In the Database Nodes section of the Overview page, click in the upper-right corner of the section 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 may last for approximately 30 seconds during the switchover. Make sure that your application can automatically reconnect to the cluster.
|FailoverDBCluster||Manually switches services between the primary node and a read-only node of a specified PolarDB cluster. You can specify a read-only node as the new primary node.|