All Products
Search
Document Center

PolarDB:Create a multi-zone cluster and change the primary zone

Last Updated:Aug 09, 2024

PolarDB for PostgreSQL allows you to create multi-zone clusters. Compared with single-zone clusters, multi-zone clusters can enhance disaster recovery capabilities and withstand data center-level faults. This topic describes how to create a multi-zone cluster and change the primary zone of a cluster.

Prerequisites

  • The region in which you want to deploy the multi-zone cluster contains at least two zones.

  • The zones have sufficient computing resources.

Multi-zone cluster architecture

In a multi-zone cluster, data is distributed across the zones. You must deploy compute nodes only in the primary zone. PolarDB reserves sufficient resources in the secondary zones to ensure a successful failover when the primary zone fails. The following figure shows the multi-zone cluster deployment architecture.

架构

Billing

You can use multi-zone deployment for a cluster free of charge.

Note

You can upgrade a single-zone cluster to a multi-zone cluster free of charge.

Set up a multi-zone cluster architecture

If the prerequisites are met, a multi-zone cluster is automatically created when you create a cluster.

You can upgrade an existing single-zone cluster to a multi-zone cluster. The upgrade is automatically completed by online data migration, and does not affect your business.

View the zones of a cluster

  1. Log on to the PolarDB console.

  2. In the upper-left corner of the PolarDB console, select the region in which the cluster is deployed.

  3. Click the ID of the cluster.

  4. On the Basic Information page of the cluster, view the value of the Zones parameter.数据分布的可用区

Change the primary zone

You can change the primary zone of a PolarDB cluster. This feature allows you to migrate the compute nodes of a cluster to a different zone. This feature is suitable for scenarios such as disaster recovery or when an Elastic Compute Service (ECS) instance needs to access the cluster in a nearby zone. 更换主可用区

Important

For a PolarDB for PostgreSQL cluster for which hot standby is enabled, you cannot change the primary zone after you enable tiered storage for cold data for the cluster. To change the primary zone in such cases, contact us.

  1. Log on to the PolarDB console.

  2. In the upper-left corner, select the region where the cluster to which you want to connect is deployed.

  3. Find the cluster and click its ID.

  4. On the Basic Information page of the cluster, click Change Primary Zone.

    迁移可用区

  5. In the dialog box that appears, configure the Destination Zone and Destination vSwitch parameters, and then configure the Effective Time parameter based on your business requirements.

    对话框

    Note
    • If the destination zone is a secondary zone, data migration is not required. The system migrates only the compute nodes. The average time required to migrate a node across data centers is 5 minutes. In most cases, the operation is performed during disaster recovery drills.

    • If the destination zone is not a secondary zone, data must be migrated. The time required to migrate data varies based on the amount of data. If the amount of data is excessively large, the operation may require several hours to complete. Proceed with caution. In most cases, this operation is performed to adjust the distribution of applications and databases among zones for applications to access databases from the nearest zone.

  6. In the message that appears, click OK.

    Important

    After the primary zone is changed, the primary endpoint and the cluster endpoints of the cluster remain unchanged. However, the vSwitch and IP address may be changed. This operation may disrupt your database service for less than 60 seconds. Proceed with caution.