Architecture Center
Deploy MongoDB Instances in Multiple Regions

Deploy MongoDB Instances in Multiple Regions

Some businesses operate in multiple regions. You can deploy MongoDB instances in multiple regions according to the business distribution to support multi-region business operations. A typical deployment uses MongoDB in one of the two regions as the main business data source where the applications write data. MongoDB in the other region mainly reads and synchronizes data from MongoDB in the main business region. This solution installs and deploys the MongoShake service, an open-source project developed and maintained by Alibaba on the ECS of the main business region. MongoShake supports the large-scale, cross-regional, e-commerce business of Alibaba Group to achieve one-way data synchronization from MongoDB in the main region to MongoDB in the other region. The synchronization latency depends on the instance load and network latency. The ideal latency control for the generated environment is milliseconds.
Reference Architecture
The following architecture diagram demonstrates how to deploy MongoDB instances in two business regions.
1. Install MongoDB instances in the specified regions. Then, install the ECS instance in the main business region where the source MongoDB is. MongoShake will be installed on this ECS instance later. In this solution, we use Terraform to build a MongoDB replica set and an ECS instance.
2. Configure the related security settings, such as accounts, security groups, and public network addresses on MongoDB and ECS .
3. Install and configure MongoShake on ECS.
4. Activate the MongoShake service and run sample applications to read and write from MongoDB. Observe and check the data duplication process.
5. Refer to the Terraform Template for Building Resources to configure Terraform.
6. Refer to the Python Scripts for Monitoring Data Synchronization to write the Python scripts for monitoring the data synchronization of MongoDB.
7. Refer to the Deployment Guide to complete the deployment process step by step.
Operational Excellence
The Alibaba Cloud ApsaraDB for MongoDB console provides system monitoring metrics for CPU, memory, IOPS, disk usage, and networks. It offers customizable configurations and alarms to monitor the system and services, so you can swiftly respond to and resolve performance issues and define standard daily operations.
MongoShake provides the mongoshake-stat tool to monitor the data duplication process. You can evaluate the data transmission quality through metrics, such as data volume and latency.
Alibaba Cloud ApsaraDB for MongoDB supports SSL and TDE encryptions to guarantee data security during transmission and storage. You can create whitelists or ECS security groups for MongoDB instances to enhance permission management.
The 3-node ReplicaSet and sharding cluster of Alibaba Cloud ApsaraDB for MongoDB guarantee the high availability of MongoDB services. Alibaba Cloud also guarantees the SLA of MongoDB.

Cloud Database Solutions for Gaming

Solve all data problems with matured and customized architectures

Learn More >

Cloud Database Solutions for FinTech

Leverage cloud-native database solutions dedicated for FinTech.

Learn More >

Database Migration Solution

Migrate to fully managed cloud databases.

Learn More >

Reach Alibaba Cloud experts for support

Contact Us
phone Contact Us