Create a multi-zone replica set instance

更新时间:
复制 MD 格式

ApsaraDB for MongoDB provides a zone-disaster recovery solution for high reliability. This solution deploys the three nodes of a replica set across two or three different zones within the same region. The nodes communicate with each other over an internal network.

Prerequisites

Notes

Three-zone deployment

If your application is deployed on an ECS instance, the ApsaraDB for MongoDB instance and the ECS instance must meet the following conditions for network connectivity. To view ECS instance information, see View instance information.

  • Your ApsaraDB for MongoDB instance and ECS instance are deployed in the same region.

  • Your ApsaraDB for MongoDB instance and ECS instance use the same network type.

    Note
    • The same zone is recommended because the same zone reduces network latency.

    • VPC is recommended because VPC provides higher security.

    • If the network type is VPC, you must ensure that they use the same VPC ID.

    • If you want to use the VPC network type, but the network type of the ECS instance is classic network, you can change the network type of the ECS instance to VPC. For more information, see Migrate ECS instances from the classic network to a VPC.

Dual-zone deployment

  • If your application is deployed on an ECS instance, the ApsaraDB for MongoDB instance and the ECS instance must meet the following conditions for network connectivity. To view ECS instance information, see View instance information.

    • Your ApsaraDB for MongoDB instance and ECS instance are deployed in the same region.

    • Your ApsaraDB for MongoDB instance and ECS instance use the same network type.

      Note
      • The same zone is recommended because the same zone reduces network latency.

      • VPC is recommended because VPC provides higher security.

      • If the network type is VPC, you must ensure that they use the same VPC ID.

      • If you want to use the VPC network type, but the network type of the ECS instance is classic network, you can change the network type of the ECS instance to VPC. For more information, see Migrate ECS instances from the classic network to a VPC.

  • If the write concern of MongoDB is set to writeConcern=majority, a write operation is considered successful only after it is propagated to a majority of the nodes in the replica set. Therefore, if the zone that contains two nodes fails, data loss may occur within the synchronization latency time window between the primary node and the node in the other active zone.

  • You can choose between manual and automatic switchover for a dual-zone deployment. You can configure this setting on the product page in the console. The default is manual switchover.

Limits

  • Multi-zone replica set instances that use disks can be deployed only in specific regions. For more information about supported regions, see Disk version (Three-zone deployment) and Disk version (Dual-zone deployment).

  • Instances that use local disks support only single-zone deployment. However, you can achieve a multi-zone deployment for a replica set instance by configuring the zones. To do this, select zones in the format of Region (Zone 1+Zone 2+Zone 3), such as Shenzhen Zone (C+D+E). For more information about supported regions, see Local disk version.

  • You can deploy a multi-zone replica set instance by selecting any three of the following zones in the China (Shanghai) Finance Cloud region: Z, K, F, G, and A.

Node deployment policies

Zone

Deployment description

Single zone

The system automatically deploys the primary, secondary, and hidden nodes of the replica set instance to the same zone.

image

Dual-zone

The system automatically deploys the primary, secondary, and hidden nodes of the replica set instance to two different zones.

If a zone becomes unavailable due to force majeure events such as a power outage or network failure, the system responds based on your configured dual-zone switchover mode. The modes are as follows:

  • Manual switchover: If a zone fails, high availability (HA) does not automatically switch over to restore availability. An extra manual confirmation step is required during the zone failure. The automatic switchover process begins only after you confirm that you accept potential data loss.

  • Automatic switchover: If a zone fails, HA automatically starts the remaining node as a single-node instance to restore availability. Data loss may occur within the synchronization latency time window during this process.

image

Three-zone

The system automatically deploys the primary, secondary, and hidden nodes of the replica set instance to three different zones.

If a zone becomes unavailable due to force majeure events such as a power outage or network failure, the HA system automatically triggers a switchover to ensure the continuous availability of the replica set architecture.

image

Procedure

For more information about how to create a multi-zone replica set instance, see Create a replica set instance.

More information

The service availability feature provides a clear view of the node distribution across zones. You can switch node roles based on your deployment to allow applications to connect to the nearest node. For more information, see Switch node roles.