All Products
Search
Document Center

PolarDB:Use the cross-zone automatic switchover feature

Last Updated:Aug 13, 2024

PolarDB supports the cross-zone automatic switchover feature.

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.

Usage notes

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

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

  • The hot standby cluster feature has been enabled for your cluster.

  • Your cluster uses the pay-as-you-go or subscription billing method.

Limits

  • RPO and RTO

    • In asynchronous scenarios, the cross-zone automatic switchover feature may cause data loss. In most cases, the recovery point objective (RPO) is less than 100 ms. In the worst cases, the RPO is 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.

  • Available resources are deployed in two or more zones within the region in which the PolarDB for MySQL cluster is deployed. The multi-zone deployment feature is unavailable 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 in seconds if the compute nodes in the primary zone of the cluster are unavailable. This ensures the availability of the PolarDB cluster.

Billing

The cross-zone automatic switchover feature is provided free of charge.

Procedure

Use 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 that you want to manage resides.

  3. Find the cluster and click the cluster ID.

  4. In the left-side navigation pane, choose Settings and Management > Service Availability to go to the Cluster Availability page.

  5. Click Cross-zone Automatic Switchover.

    image

  6. 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.

  7. (Optional) Enable the semi-synchronous mode for cross-zone data replication.

    Note
    • Semi-synchronous mode: A transaction is successfully committed only after the redo logs generated by this transaction are persistently stored on the cross-zone backup node.

    • Asynchronous mode: A transaction is successfully committed after the redo logs generated by this transaction are persistently stored on the read/write node.

    1. Click Modify Data Replication Mode.

      image

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

      image

Switch back 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 Change Primary Zone or Switch to Original 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 back 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

To switch back to the original primary zone, you can change the primary zone to the original primary zone. For more information, see Change the primary zone and vSwitch of a cluster.