PolarDB for PostgreSQL and support multi-availability zone (multi-AZ) deployment. PolarDB provides several deployment options, including Dual-zone (hot standby storage cluster enabled) and Dual-zone (hot standby storage cluster and compute standby enabled). You can select the deployment option that best suits your needs.
Multi-AZ deployment
In a multi-AZ deployment, data is distributed across multiple availability zones. The primary and secondary zones each store three data replicas, for a total of six replicas. This design ensures higher SLA reliability. The compute nodes run in the primary zone. The hot standby storage cluster and compute nodes in the secondary zone are used for failover if the primary zone fails. For more information, see Change the primary zone.
-
To use a multi-AZ deployment, the following conditions apply:
-
The cluster's region must have two or more availability zones.
-
The secondary zone must have sufficient compute resources.
-
-
To use the Dual-zone (hot standby storage cluster and compute standby enabled) multi-AZ deployment architecture, contact us.
High-availability modes
Overview of options
Single-zone (hot standby disabled)
-
Database services are provided only in the primary zone. This option does not provide a hot standby storage cluster and is more cost-effective.
-
If the entire availability zone fails, the recovery time is longer. If you require cross-zone high availability, we recommend using a multi-AZ deployment.
Switching rules
You can switch to either Dual-zone (hot standby storage cluster enabled) or Dual-zone (hot standby storage cluster and compute standby enabled).
Use cases
-
Small websites or applications
This is a cost-effective option that offloads database operations and maintenance, allowing you to focus on your business.
-
Personal learning
Ideal for beginners to test and learn about databases.
-
Development and testing
Rapid provisioning lets you create and release resources on demand, significantly improving development and testing efficiency.
Dual-zone (hot standby enabled)
-
This option distributes data across multiple availability zones. The primary and secondary zones each store a complete copy of the data, providing higher SLA reliability.
-
All compute nodes run in the primary zone. The hot standby storage cluster in the secondary zone is used for failover if the primary zone becomes unavailable.
Switching rules
You can only switch to Single-zone (hot standby storage cluster disabled).
Billing
Data is distributed across multiple availability zones, with the primary and secondary zones each storing three data replicas (for a total of six replicas). Storage costs are higher than for the Single-zone (hot standby storage cluster disabled) option.
Use cases
This classic high-availability architecture is suitable for over 80% of business scenarios, including internet, Internet of Things (IoT), retail, e-commerce, logistics, and gaming.
Dual-zone (hot standby and compute standby)
-
Data is distributed across multiple availability zones. The primary and secondary zones each store a complete copy of the data, which provides higher SLA reliability.
-
The hot standby storage cluster and standby node in the secondary zone are used for failover if the primary zone becomes unavailable. The standby node in the secondary zone can serve read requests. After a failover, the system promotes the standby node to a primary node.
Switching rules
You can only switch to Single-zone (hot standby storage cluster disabled).
Billing
-
Compute nodes
A corresponding standby node is added to the secondary zone that contains the hot standby storage cluster. By default, the node specifications are the same as those in the primary zone, and the standby node is billed separately.
-
Storage space
Data is distributed across multiple availability zones, with the primary and secondary zones each storing three data replicas (for a total of six replicas). Storage costs are higher than for the Single-zone (hot standby storage cluster disabled) option.
Use cases
Suitable for core production databases of large and medium-sized enterprises that require high availability, such as in finance, new retail, automotive manufacturing, education, and large-scale enterprise resource planning (ERP) systems.
For more information about the billing rules for compute nodes and storage space, see Billing.
Enable or switch high-availability mode
-
When you purchase a cluster, you can select a high-availability mode in the Network and Zone section.
NoteThe available high-availability mode options are subject to the number of availability zones and resources in the region where the cluster is located. The options on the purchase page prevail.
The high-availability mode options include: Dual-zone (hot standby storage cluster enabled), Single-zone (hot standby storage cluster disabled), and Dual-zone (hot standby storage cluster and compute standby enabled).
-
Go to the . Click the target cluster ID. On the Basic Information page, find the Distributed Storage section and click Switch to HA Mode.
View cluster availability zones
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the Region where the cluster is located, and then click the target cluster ID to go to the cluster details page.
-
On the Basic Information page, view the Availability Zone for Data Distribution.
Change the primary zone
In a multi-AZ deployment, PolarDB allows you to change the primary zone. You can use this feature to migrate the compute nodes of a database cluster to another availability zone. This is useful for disaster recovery or for co-locating your database with ECS instances for lower latency access.
For a PolarDB for PostgreSQL or cluster with hot standby enabled, you cannot change the primary zone after you enable tiered storage for cold data. To change the primary zone in this case, contact us.
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the Region where the cluster is located, and then click the target cluster ID to go to the cluster details page.
-
In the Distributed Storage section, click Change the primary availability zone.
-
In the dialog box that appears, select a Target Zone and a Target Switch, and then select an Effective Date based on your business needs.
In the Database Nodes section, select All. For Effective Time, select Effective Immediately or Effective Within Maintenance Window, and then click OK.
Note-
If the destination zone is the secondary zone, data migration is not required. The system only needs to switch the database compute nodes, enabling fast cross-datacenter switching (average time of 5 minutes per node). This operation is often used for disaster recovery drills.
-
If the destination zone is not the secondary zone, data migration is required. The migration time depends on the data volume and can take several hours. Proceed with caution. This operation is typically used to adjust how your application and database are distributed across availability zones so your application can access the database from the nearest zone.
-
-
Click OK.
ImportantAfter you change the primary zone, the database connection endpoints (cluster endpoint and primary endpoint) remain unchanged, but the vSwitch and IP address might change. This operation may cause a service disruption for less than one minute. Proceed with caution.
Create a standby node read endpoint
-
You can create a standby node read endpoint only if the high-availability mode is set to Dual-zone (hot standby storage cluster and compute standby enabled). To create a cluster in this mode or switch to this mode, contact us.
-
The standby node read endpoint supports only private IP addresses.
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters. Select the Region where the cluster is located, and then click the target cluster ID to go to the cluster details page.
-
In the Database Connections section, click Create Read-only Node Endpoint. In the dialog box, click OK. Once created, you can use the endpoint to access the standby node.