ApsaraDB PolarDB PostgreSQL-compatible edition 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.
- The region must contain at least two zones.
- The zones must have sufficient computing resources.
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.
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
- Log on to the Apsara PolarDB console.
- In the upper-left corner of the console, select the region where the target cluster is deployed.
- Click the ID of the cluster that you want to manage.
- On the Overview page, view Zones.
Change the primary zone
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region where the cluster is deployed.
- Find the cluster and click the cluster ID.
- On the Overview page, click Migrate Cluster Across Zones.
- In the dialog box that appears, specify Target Zone and Target VSwitch, and set Effective Time base on your business requirements.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.
- Click OK.Notice 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.