All Products
Search
Document Center

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

Last Updated:Dec 20, 2023

This topic describes how to create a multi-zone replica set instance. ApsaraDB for MongoDB provides a zone-disaster recovery solution to ensure the high reliability and availability of your replica set instance. This solution deploys the nodes of a three-node replica set instance across three different zones in 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.

Usage notes

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 the information about ECS instances, 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 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

  • You can deploy multi-zone replica set instances that use cloud disks only in specific regions. For more information about the supported regions, see Cloud disk-based instances (multi-zone deployment).

  • You can select only Single-zone for ApsaraDB for MongoDB instances that use local disks. You can configure the Zone parameter for replica set instances to implement multi-zone deployment. To implement multi-zone deployment, you must select zones in the following format: Region (Zone 1 + Zone 2 + Zone 3). Example: Shenzhen Zone (C + D + E). For more information about the supported regions, see Local disk-based instance.

Node deployment policies

Zone

Description

Single-zone

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

Multi-zone

The system automatically deploys the primary node, the hidden node, and the secondary nodes of a replica set instance in different zones.

Procedure

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

References

You can use the service availability feature to view the deployment of nodes in an instance across zones. You can also switch the node roles of an instance based on your business deployment. This way, your application can be connected to the nearest nodes. For more information, see Switch node roles.