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.

Limits

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

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the Database Nodes section on the Overview page, click the Switchover icon in the upper-right corner to switch views.
  5. Click Switch Primary Node.
    1
  6. 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.

The system performs the following steps to automatically elect a primary node:
  1. Find all the read-only nodes that can be elected as the primary node.
  2. Select one or more read-only nodes that have the highest failover priority.
  3. 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

API Description
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.