Permission Requirement to migrate MongoDB to ApsaraDB for MongoDB
DTS allows you to migrate data from on-premises MongoDB to ApsaraDB for MongoDB. With the data change replication function, you can perform the migration without stopping services.

Migration types

For data migrations from on-premises MongoDB to ApsaraDB for MongoDB, DTS supports the following migration types: migrate existing data and replicate data changes. The features and restrictions of these migration types are as follows:


Migrate existing data

This migrates all existing data in the source instance to the target instance.
Replicate data changes


If you also choose to replicate data changes, the data changes made to the source instance during the migration will be synchronized to the target instance, so that eventually the source instance is dynamically synchronous with the target instance. This allows you to perform the migration while on-premises MongoDB remains operational. 

Migration functions


The supported MongoDB versions are 3.0 and 3.2.
MongoDB existing data migration supports:


Database migration
Collection migration
Index migration

MongoDB data change replication supports:


Synchronization of create, delete, update operations on documents
Synchronization of create and delete operations on collections
Synchronization of create and delete operations on databases
Synchronization of create and delete operations on indexes



Migration procedure

The following describes the procedure of configuring a migration task from on-premises MongoDB to ApsaraDB for MongoDB.

Create accounts
When configuring a migration task, you need to provide the accounts of the source and target instances. The accounts must have the permissions listed in the preceding Migration permissions section.

If the source or target MongoDB instance does not have an account with required permissions, create one as follows:

db.createUser({user:"username",pwd:"password",roles:[{role:"rolename1",db:"database_name1"},{role:"rolename2",db:"database_name2"}]})


Parameter description:


username: Username of the account to be created
password: Password of the account to be created
rolename1/rolename2: Roles to be assigned to the username. Example roles are read and readWrite.
database_name1/database_name2: In the preceding example, role1 and role2 of database_name1 and database_name2 are assigned to the username.


You can check this link for more detailed information