An Apsara PolarDB cluster consists of one writer node and one or more reader nodes. This topic describes how to switch your workloads from a writer node to a reader node. If a failure occurs on a writer node, the system can automatically perform a failover. You may want to manually switch your workloads from the writer node to a reader node to run a disaster recovery drill and to specify a certain reader node as the writer node.
An Apsara PolarDB cluster may be disconnected for approximately 30 seconds during switchover. We recommend that you perform the switchover during off-peak hours and make sure that your application can automatically reconnect to the Apsara 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.
- In the upper-right corner of the Node Information section, click Switch Primary Node.
- In the Switch Primary Node dialog box that appears, select a new writer node from the New Primary Node drop-down list, and click OK.
Note If you do not select a new writer node from the New Primary Node drop-down list, the system automatically promotes a reader node with the highest failover priority to the new writer node. The cluster may be disconnected for approximately 30 seconds during switchover. Make sure that your application can automatically reconnect to the cluster.
Automatic failover between the writer node and reader nodes
An Apsara PolarDB cluster runs in an active-active high-availability architecture. This architecture allows for automatic failovers between the writer node and reader nodes.
Each node of the cluster has a failover priority. This priority determines the probability that the system promotes this node to the writer node if a failover occurs. If multiple nodes have the same failover priority, they all have the same probability of being promoted to the writer node.
The system follows these steps the to promote a reader node to the writer node:
- Find all reader nodes that can be promoted to the writer node.
- Select one or more reader nodes that have the highest failover priority.
- If the failover to the first node fails due to network or replication errors, the system tries to switch the workloads to the next available node. The system continues the failover until one of the available nodes is promoted to the writer node.
Related API operations
|FailoverDBCluster||Manually switches your workloads from the writer node to a specified reader node in an Apsara PolarDB cluster.|