PolarDB for PostgreSQL allows you to create multi-zone clusters. Compared with single-zone clusters, multi-zone clusters have better disaster recovery capabilities and can withstand breakdowns in data centers. This topic describes how to deploy a cluster across multiple zones and change the primary zone.

Prerequisites

  • The region must contain at least two zones.
  • The zones must have sufficient computing resources.

Multi-zone architecture

When a multi-zone cluster is deployed, data is distributed across zones. Compute nodes must be deployed in the primary zone. PolarDB reserves sufficient resources in a secondary zone to ensure a successful failover when the primary zone fails. The following figure shows the multi-zone architecture.

Architecture

Billing

No additional fee is required for multi-zone deployment.
Note You can upgrade a single-zone cluster to a multi-zone cluster for free.

Establish a multi-zone architecture

When the prerequisites are met, a multi-zone cluster is created when you Create a PolarDB for PostgreSQL cluster.

You can also upgrade existing single-zone clusters to multi-zone clusters. This upgrade is automatically achieved by online migration, and does not affect your workloads.

View the zones of a cluster

  1. Log on to the Apsara PolarDB console.
  2. In the upper-left corner of the console, select the region where the target cluster is deployed.
  3. Click the ID of the cluster that you want to manage.
  4. On the Overview page, view Zones.Zones

Change the primary zone

You can change the primary zone of an PolarDB cluster. This feature allows you to migrate the compute nodes of a database cluster to a different zone. This is applicable to scenarios such as disaster recovery or when an Elastic Compute Service (ECS) instance is required to access the cluster in a nearby zone. Change the 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 is deployed.
  3. Find the cluster and click the cluster ID.
  4. On the Overview page, click Migrate Cluster Across Zones.
    Migrate a cluster across zones
  5. In the dialog box that appears, specify Target Zone and Target VSwitch, and set Effective Time base on your business requirements.
    Dialog box
    Note
    • If the destination zone is a secondary zone, data migration is not required. Switching to a new secondary zone is fast because only compute nodes are switched. The average time required to migrate a compute node is five minutes. This operation is often performed during disaster recovery drills.
    • If the destination zone is not a secondary zone, data must be migrated. This migration process may take several hours depending on the data size. Proceed with caution. This operation is used to adjust the zones of applications and databases to speed up access from a nearby zone.
  6. Click OK.
    Important After the primary zone is changed, the primary endpoints and cluster endpoints remain unchanged, but the vSwitch and IP address may be changed. This operation may disrupt your database service for less than 60 seconds. Proceed with caution.