All Products
Search
Document Center

PolarDB:Automatically switch the primary zone of a cluster

Last Updated:Apr 12, 2024

This topic describes the cross-zone automatic switchover feature that is supported by PolarDB.

Overview

After you enable the cross-zone automatic switchover feature for a PolarDB cluster, the cluster can automatically perform a switchover between the primary and secondary zones when resources in the primary zone of the cluster are unavailable. For example, all compute nodes in the primary zone fail at the same time. In this case, the secondary databases in the secondary zone are used as the new primary databases to restore the availability of the PolarDB cluster.

PolarDB allows you to replicate data across zones in semi-synchronous mode. This reduces the recovery point objective (RPO) of automatic switchover and prevents data loss.

Prerequisites

  • Only PolarDB for MySQL Cluster Edition clusters support the cross-zone automatic switchover feature.

  • Only PolarDB for MySQL 8.0.1 clusters whose revision version is 8.0.1.35.1 or later support cross-zone data replication in semi-synchronous mode.

  • The hot replica feature is enabled for the PolarDB for MySQ cluster that you purchase.

  • The billing method of your cluster is pay-as-you-go or subscription.

Usage notes

  • PolarDB allows you to perform tests for cross-zone automatic switchover. If you want to perform a test for cross-zone automatic switchover, contact technical support. Alibaba Cloud provides technical support to ensure that you can perform the test as expected.

  • RPO and RTO

    • In asynchronous scenarios, the cross-zone automatic switchover feature causes data loss with an RPO of less than 60 seconds. Evaluate the impact of a cross-zone automatic switchover before you use the feature.

    • In semi-synchronous scenarios, cluster performance is compromised by about 10% after you enable the cross-zone automatic switchover feature for a PolarDB cluster. By default, the waiting period for a transaction to be committed is 500 milliseconds. If the waiting period exceeds 500 milliseconds, the transaction becomes an asynchronous transaction and no longer waits to be synchronized to the secondary zone. If the waiting period does not exceed 500 milliseconds, the RPO is 0.

    • In asynchronous and semi-synchronous scenarios, the recovery time objective (RTO) is less than 30 seconds.

  • You must deploy resources in at least two zones in the region in which the PolarDB cluster resides. Multi-zone deployment is not supported in the following regions: Philippines (Manila), South Korea (Seoul), Australia (Sydney), China (Qingdao), China (Chengdu), China (Hohhot), and Thailand (Bangkok).

Benefits

Switchover in seconds

After you enable the cross-zone automatic switchover feature for a PolarDB cluster, the PolarDB cluster automatically can perform a switchover between the primary and secondary zones within seconds if the compute nodes of the cluster in the primary zone are unavailable. This ensures the availability of the PolarDB cluster.

Billing

You can use the cross-zone automatic switchover feature at no costs.

Procedure

Enable or disable the cross-zone automatic switchover feature

Enable the cross-zone automatic switchover feature

  1. Log on to the PolarDB console.

  2. In the upper-left corner of the console, select the region in which the cluster for which you want to enable the cross-zone automatic switchover feature resides.

  3. Find the cluster and click the cluster ID.

  4. On the Basic Information page, find the Cross-zone Automatic Switchover parameter and click Enable to the right of the parameter.

    image.png

  5. In the message that appears, click OK.

    After you enable the cross-zone automatic switchover feature for the cluster, the cluster automatically performs a switchover between the primary and secondary zones when resources in the primary zone are unavailable.

  6. Optional. Enable the semi-synchronous mode for cross-zone data replication.

    Note
    • Semi-synchronous mode: You must wait until the redo logs that are generated by a transaction are persisted on the cross-zone backup node before the transaction is committed.

    • Asynchronous mode: You do not need to wait for the redo logs that are generated by a transaction to be persisted on the cross-zone backup node. After the redo logs are persisted on the primary node, the transaction is committed.

    1. Find the Cross-zone Data Replication parameter and click Modify to the right of the parameter.

      image.png

    2. In the dialog box that appears, set the Cross-zone Data Replication parameter to Semi-synchronous, and click OK.

Disable the cross-zone automatic switchover feature

  1. Log on to the PolarDB console.

  2. In the upper-left corner of the console, select the region in which the cluster for which you want to disable the cross-zone automatic switchover feature resides.

  3. Find the cluster and click the cluster ID.

  4. On the Basic Information page, find the Cross-zone Automatic Switchover parameter and click Disable to the right of the parameter.

  5. In the message that appears, click OK.

Switch to the original primary zone

After you enable the cross-zone automatic switchover feature for a cluster, you can switch to the original primary zone of the cluster by clicking Switch to Original Primary Zone or Change Primary Zone after resources in the original primary zone are recovered.

Note
  • After the cluster automatically switches to the secondary zone, the network can be accessed across zones and access latency occurs. We recommend that you switch to the original primary zone of the cluster.

  • If you switch to the original primary zone of the cluster by clicking Switch to Original Primary Zone, the original vSwitch is used.

  • If you switch to the original primary zone of a cluster by clicking Change Primary Zone, you can select another vSwitch.

Switch to the original primary zone

  1. Log on to the PolarDB console.

  2. In the upper-left corner of the console, select the region in which the cluster that you want to manage resides.

  3. Find the cluster and click the cluster ID.

  4. On the Basic Information page, click Switch to Original Primary Zone.

  5. In the message that appears, click OK.

Change the primary zone

You can switch to the original primary zone of a cluster by clicking Change Primary Zone. For more information, see Change the primary zone and vSwitch of a cluster.