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.

Prerequisites

An Alibaba Cloud account is created. For more information, see Sign up with Alibaba Cloud.

Precautions

  • Replica set instances that run MongoDB 4.4 or later 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.
      Note
      • 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.

Limits

  • Replica set instances that run MongoDB 4.2 or earlier 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 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

Deployment Description
Single-zone deployment The system deploys the primary, secondary, and hidden nodes within a single zone. Single-zone deployment
Multi-zone deployment The system deploys the primary, secondary, and hidden nodes across three different zones. Multi-zone deployment

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the left-side navigation pane, click Replica Set Instances.
  3. On the Replica Set Instances page, click Create Instance.
  4. Set Product Type to Replica Set (Subscription) or Replica Set (Pay-as-you-go).
  5. Set Region.

    You can set Region to China (Shenzhen), China (Hong Kong), or Singapore.

  6. Set Zone.

    You can set Zone to Shenzhen Zones (C + D + E), Hongkong Zones (B + C+ D), or Singapore Zones (A + B + C).

  7. Configure other parameters and purchase the instance. For more information, see Create a replica set instance.

Additional information

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.