ApsaraDB for MongoDB deploys the three nodes of a replica set instance across two or three zones in the same region. The nodes replicate data over an internal network, providing zone-disaster recovery for high reliability and availability.
Prerequisites
An Alibaba Cloud account. For more information, see Sign up with Alibaba Cloud.
Dual-zone deployment is in private preview. To use this feature, submit a ticket.
Network requirements
If your application runs on an Elastic Compute Service (ECS) instance, ensure the following for network connectivity between the ECS instance and the ApsaraDB for MongoDB instance. For details on viewing ECS instance properties, see View instance information.
| Requirement | Details |
|---|---|
| Same region | Both instances must be deployed in the same region. |
| Same network type | Both instances must use the same network type. |
| Same virtual private cloud (VPC) | If the network type is VPC, both instances must belong to the same VPC. |
Deploy both instances in the same zone to reduce network latency.
VPC is recommended for higher security.
If your ECS instance uses classic network, you can migrate it to VPC. For more information, see Migrate ECS instances from the classic network to a VPC.
Dual-zone considerations
If the
{w: "majority"}write concern is set on a replica set instance, write operations are not considered successful until a majority of nodes confirm them. In a disaster recovery scenario where a fault occurs in the zone that contains two nodes, data loss may occur due to replication lag between the primary node and the node in the other zone.Dual-zone switchover supports manual and automatic modes. Specify the switchover mode on the instance details page. The default mode is manual switchover.
Limits
Multi-zone replica set instances that use cloud disks are available only in specific regions. For supported regions, see the Cloud disk-based instances (three-zone deployment) and Cloud disk-based instances (dual-zone deployment) sections in "Available regions and zones."
For instances that use local disks, select Single-zone and configure the Zone parameter to deploy across zones. Select a region with a combined zone format such as
Shenzhen Zones (C + D + E). For supported regions, see the Local disk-based instances section in "Available regions and zones."
Node deployment policies
Single zone
The primary, secondary, and hidden nodes are all deployed in the same zone.
Dual-zone
The primary, secondary, and hidden nodes are deployed across two zones. If a zone becomes unavailable due to power outages or network failures, the system restores instance availability based on the switchover mode:
Manual switchover: The high availability (HA) system does not automatically switch over. It starts a dual-zone instance to restore availability. You must manually confirm that switchover occurs only after you accept potential data loss.
Automatic switchover: The HA system automatically starts the remaining nodes as a single node to restore availability. Data loss may occur due to replication lag.
Three-zone
The primary, secondary, and hidden nodes are deployed across three zones. If a zone becomes unavailable due to power outages or network failures, the HA system automatically switches services to another zone.
Procedure
For instructions on creating a multi-zone replica set instance, see Create a replica set instance.
Related information
Use the service availability feature to view how nodes are deployed across zones. You can switch node roles based on your business deployment so applications connect to the nearest nodes. For more information, see Switch node roles.