All Products
Search
Document Center

ApsaraDB for MongoDB:Create a multi-zone replica set instance

Last Updated:Feb 27, 2026

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

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.

RequirementDetails
Same regionBoth instances must be deployed in the same region.
Same network typeBoth 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.
Note

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

Node deployment policies

Single zone

The primary, secondary, and hidden nodes are all deployed in the same zone.

Single-zone deployment

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.

Dual-zone deployment

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.

Three-zone deployment

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.