ApsaraDB for MongoDB provides a variety of disaster recovery solutions.

Multi-zone instances

Alibaba Cloud provides cloud computing services for multiple regions around the world. Each region contains multiple zones. Faults are isolated between different zones within the same region. Network latency is low between different zones within the same region.

An ApsaraDB for MongoDB single-zone instance runs on two physical servers within the same zone. All racks, air conditioners, circuits, and networks in the zone are redundant to ensure high availability. ApsaraDB for MongoDB provides service availability that goes beyond the limits of physical servers by using the asynchronous or semi synchronous replication mode and an efficient primary/secondary failover mechanism.

To provide higher availability than single-zone instances, ApsaraDB for MongoDB also supports multi-zone instances. Multi-zone instances are deployed on physical servers within different zones. When one zone fails, services can be switched over to another zone in a short period of time. The entire switchover process does not require changes to application code.

Note Each time you trigger a primary/secondary failover for an instance, the instance may be disconnected for no more than 30 seconds. We recommend that you perform this operation during off-peak hours and make sure that your applications can automatically re-establish a connection.

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

For more information about how to migrate instances to different zones within the same region, see Migrate an ApsaraDB for MongoDB instance to different zones in the same region.

Cross-region disaster recovery instances

ApsaraDB for MongoDB multi-zone instances provide disaster recovery across different zones within the same region. To improve availability, ApsaraDB for MongoDB also supports cross-region data disaster recovery. For example, you can replicate data from ApsaraDB for MongoDB Instance A in the China (Hangzhou) region to ApsaraDB for MongoDB Instance B in the China (Shanghai) region by using a data synchronization tool such as MongoShake. Instance B is a self-contained instance that has its own endpoints, account, and permissions. Instance B can be used to recover data and read data in the region where the instance resides.

For more information about how to replicate ApsaraDB for MongoDB instance data by using MongoShake, see Use MongoShake to implement one-way synchronization between ApsaraDB for MongoDB replica set instances.

Instance A serves as a primary instance, and Instance B serves as a secondary instance. If Instance A fails due to an unexpected event such as a natural disaster in the region where Instance A resides, Instance B can be used as the primary instance. Cross-region data disaster recovery is implemented by modifying database connection configurations in your application to forward requests to Instance B.

  • We recommend that you deploy the same geo-disaster recovery application on Instance A and Instance B to minimize the network instability and latency associated with cross-region access.
  • If Instance B is used as the primary instance, you must run the kill command to disable the MongoShake service. This way, data replication from Instance A to Instance B is stopped and possible problems are prevented.