This topic describes how to migrate data from a self-managed standalone MongoDB database to an ApsaraDB for MongoDB instance by using Data Transmission Service (DTS).
You can also use the built-in commands of MongoDB to migrate self-managed MongoDB databases. For more information, see Migrate self-managed MongoDB databases to standalone instances by using tools provided by MongoDB.
For more information about data migration or synchronization solutions, see Overview.
Prerequisites
- The versions of the source and destination MongoDB databases are supported by DTS. For more information, see Overview of data migration scenarios.
- The available storage space of the ApsaraDB for MongoDB instance is larger than the total size of the data in the self-managed MongoDB database.
Precautions
- By default, oplogs are not supported by self-managed standalone MongoDB databases. If you use a replica set that contains only one node, oplogs are supported for DTS to implement incremental migration.
- To prevent service disruptions, we recommend that you migrate data during off-peak hours.
- If the source and destination MongoDB databases use different versions or storage engines, make sure that your applications can run on both databases. For more information about the versions and storage engines that are supported by ApsaraDB for MongoDB, see MongoDB versions and storage engines.
- The admin or local database cannot be used as the source or destination database.
Billing
Migration type | Task configuration fee | Internet traffic fee |
---|---|---|
Full data migration | Free of charge. | Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Pricing. |
Incremental data migration | Charged. For more information, see Pricing. |
Migration types
- Full data migration: DTS migrates all historical data of the source MongoDB database
to the destination MongoDB database.
Note DTS can migrate the following types of objects: database, collection, and index.
- Incremental data migration: After full data migration is completed, DTS synchronizes
incremental data of the source MongoDB database to the destination MongoDB database.
Note
- DTS can synchronize the create and delete operations that are performed on databases, collections, and indexes.
- DTS can synchronize the create, delete, and update operations that are performed on documents.
Permissions required for database accounts
Database | Full data migration |
---|---|
Self-managed MongoDB database | The read permissions on the source database |
ApsaraDB for MongoDB instance | The read and write permissions on the destination database |
For more information about how to create and authorize a database account, see the following topics:
- Self-managed MongoDB database: db.createUser()
- ApsaraDB for MongoDB instance: Manage user permissions on MongoDB databases