This guide covers the previous version of the DTS console. For the current console, see:
Use Data Transmission Service (DTS) to migrate a self-managed MongoDB database hosted on Elastic Compute Service (ECS) — standalone or replica set architecture — to ApsaraDB for MongoDB. DTS supports both full and incremental data migration, keeping your workloads running throughout the migration.
Prerequisites
Before you begin, make sure you have:
A self-managed MongoDB database running MongoDB 3.0 or later
An ApsaraDB for MongoDB instance with more storage space than the source database size
(If source and destination versions or storage engines differ) Confirmed no compatibility issues — see MongoDB versions and storage engines for supported combinations
Billing
| Migration type | Instance configurations | Internet traffic |
|---|---|---|
| Full data migration | Free | Free |
| Incremental data migration | Charged. See DTS pricing. | Free |
Migration types
Full data migration copies all existing data from the source to the destination. Migration is supported at the database, collection, and index levels.
Do not write to the source database during a full-only migration. Writes during this window can cause data inconsistency.
Incremental data migration continuously synchronizes changes to the destination after the full migration completes. The following operations are synchronized:
Create and delete operations on databases, collections, and indexes
Create, delete, and update operations on documents
To migrate without business interruptions, use both full and incremental data migration together.
Required permissions
Set up database accounts with the following permissions before you configure the migration task.
| Database | Full data migration | Incremental data migration |
|---|---|---|
| Self-managed MongoDB on ECS | Read on the source database | Read on the source database, the admin database, and the local database |
| Destination ApsaraDB for MongoDB | Read and write on the destination database | Read and write on the destination database |
To create accounts and grant permissions, see:
ApsaraDB for MongoDB: Manage the permissions of MongoDB database users
Self-managed MongoDB: db.createUser()
Usage notes
Schedule the migration during off-peak hours to minimize impact on running workloads.
Do not migrate data from the config database. It is an internal MongoDB database.
Preparations
Replica set architecture: No preparation needed. Skip this section.
Standalone architecture with incremental migration: Enable oplog on the source database before creating the migration task. For instructions, see Migrate a self-managed standalone MongoDB database to Alibaba Cloud by using DTS.
Create and run the migration task
Step 1: Open the previous-version DTS console
Log on to the DTS console.
Click the
icon in the lower-right corner to switch to the previous version of the console.In the left-side navigation pane, click Data Migration.
In the Migration Tasks section, select the region where the ApsaraDB for MongoDB instance is deployed.
In the upper-right corner, click Create Migration Task.
Step 2: Configure source and destination databases
Task name
DTS generates a name automatically. Specify a descriptive name to help identify the task later.
Source database
| Parameter | Description |
|---|---|
| Instance Type | Select User-Created Database in ECS Instance. |
| Instance Region | Select the region where the ECS instance is deployed. |
| ECS instance ID | Enter the ID of the ECS instance hosting the MongoDB database. |
| Database Type | Select MongoDB. |
| Port Number | Enter the service port of the self-managed MongoDB database. |
| Database Name | Enter the name of the database used for authentication. |
| Database Account | Enter the account used to connect to the source database. |
| Database Password | Enter the account password. Click Test Connectivity to verify. If the connection succeeds, Passed appears. If it fails, click Check next to Failed to correct the settings. |
Destination database
| Parameter | Description |
|---|---|
| Instance Type | Select MongoDB Instance. |
| Instance Region | Select the region where the ApsaraDB for MongoDB instance resides. |
| MongoDB Instance ID | Select the destination ApsaraDB for MongoDB instance. |
| Database Name | Enter the name of the database used for authentication. |
| Database Account | Enter the account used to connect to the destination database. |
| Database Password | Enter the account password. Click Test Connectivity to verify. |
Step 3: Configure the whitelist
Click Set Whitelist and Next in the lower-right corner.
DTS automatically adds its server CIDR blocks to the IP whitelist of the ApsaraDB for MongoDB instance and the security rules of the ECS instance. No manual changes are needed.
If the data source or destination is a self-managed database and the public CIDR blocks of DTS servers are added to the IP whitelist of the self-managed database to allow access from DTS servers, security risks may occur. We recommend that you strengthen authentication with accounts and passwords, restrict allowed ports, or connect to the database over Express Connect, VPN Gateway, or Smart Access Gateway.
After the migration is complete, remove the DTS server CIDR blocks from the whitelists. For the list of DTS server CIDR blocks, see Add the CIDR blocks of DTS servers.
Step 4: Select migration types and objects
Migration Type
Select one of the following options:
Full Data Migration only: Copies all existing data. Do not write to the source database during the migration to ensure data consistency.
Full Data Migration + Incremental Data Migration: Keeps workloads running throughout the migration. For standalone databases, enable oplog before starting (see Preparations).
Source Objects
Select objects from the Source Objects list and click the
icon to add them to Selected Objects. You can select databases, collections, or functions.
DTS cannot migrate the admin or local databases. To rename objects in the destination, use the object name mapping feature.
Step 5: Run the precheck
Click Precheck in the lower-right corner. The migration task starts only after the precheck passes.
If the precheck fails, click the
icon next to each failed item to view details. Fix the issues and run the precheck again.
Step 6: Start the migration
After the precheck passes, click Next.
In the Confirm Settings dialog box, select an Instance Class.
Read and accept the Data Transmission Service (Pay-As-You-Go) Service Terms.
Click Buy and Start.
Full data migration: Wait for the task to complete. Do not end the task manually — doing so may cause incomplete data migration.
Incremental data migration: The task does not stop automatically. End it manually when you are ready to cut over:
When the task progress bar displays Incremental Data Migration and The migration task is not delayed, stop writing data to the source database for a few minutes. Wait until the progress bar displays the delay time of the incremental data migration next to Incremental Data Migration.
After the status of Incremental Data Migration changes to The migration task is not delayed, manually end the migration task.

Step 7: Switch your workloads
After the migration task ends, switch your applications to the destination ApsaraDB for MongoDB instance.