This topic describes how to create a multi-zone replica set instance. ApsaraDB for MongoDB provides a zone-disaster recovery solution to ensure the reliability and availability of your replica set instance. This solution deploys the nodes of a three-node replica set instance across three different zones within the same region. These nodes exchange data with each other over an internal network. If one of the zones becomes unavailable due to force majeure factors such as a power or network failure, the high-availability (HA) system switches services over to another zone.
- Replica set instances that run MongoDB 4.4 or 5.0 cannot be deployed in multiple zones.
- If your application is deployed on an Elastic Compute Service (ECS) instance, make
sure that your ApsaraDB for MongoDB instance and ECS instance meet the following requirements
to ensure network connectivity: For more information about how to view ECS instance
information, see View instance information.
- Your ApsaraDB for MongoDB instance and ECS instance are deployed in the same region, and preferably belong to the same zone. This reduces network latency.
- Your ApsaraDB for MongoDB instance and ECS instance use the same network type.
- 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 VPC, 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.
- Replica set instances that run MongoDB 3.4, 4.0, or 4.2 can be created only in the
following zones for multi-zone deployment:
- China (Shenzhen): Shenzhen Zones (C + D + E).
- China (Hong Kong): Hongkong Zones (B + C + D).
- Singapore (Singapore): Singapore Zones (A + B + C).
- When you create a multi-zone replica set instance, you must set Active-standby Nodes to Three Nodes Replicaset.
Note You can add more nodes to the instance after the instance is created. For more information, see Change the configurations of a replica set instance.
Node deployment policies
|Single-zone deployment||The system deploys the primary, secondary, and hidden nodes within a single zone.|
|Multi-zone deployment||The system deploys the primary, secondary, and hidden nodes across three different zones.|
- Log on to the ApsaraDB for MongoDB console.
- In the left-side navigation pane, click Replica Set Instances.
- On the Replica Set Instances page, click Create Instance.
- Set Product Type to Replica Set (Subscription) or Replica Set (Pay-as-you-go).
- Set Region.
You can set Region to China (Shenzhen), China (Hong Kong), or Singapore (Singapore).
- Set Zone.
You can set Zone to Shenzhen Zones (C + D + E), Hongkong Zones (B + C+ D), or Singapore Zones (A + B + C).
- Configure other parameters and purchase the instance. For more information, see Create a replica set instance.
You can use the service availability feature to view the deployment of nodes in a replica set instance across zones. You can also switch the node roles of the instance based on your business deployment. This way, your applications can connect to the closest nodes. For more information, see Switch node roles.