When a system failure occurs, a PolarDB for MySQL cluster can automatically fail over services from the primary node to a read-only node. You can specify a read-only node as the new primary node to fail over services from the primary node to the read-only node.
During an automatic failover or a manual failover, transient disconnections may occur. Each transient disconnection lasts 20s to 30s. Make sure that your applications can be automatically reconnected to the cluster.
PolarDB for MySQL clusters use an active-active architecture that ensures high availability. If the primary node that supports reads and writes is faulty, services are automatically failed over 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.
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.
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
- Find the cluster and click the cluster ID.
In the upper-right corner of the Database Nodes section on the Overview page, click the icon to switch the display mode.
Click Fail Over.
In the dialog box that appears, select a new primary node from the New Primary Node drop-down list and click OK.
Related API operations
Performs a manual failover by promoting a read-only node to a new primary node in a PolarDB for MySQL cluster.