All Products
Search
Document Center

ApsaraDB for MongoDB:Data recovery

Last Updated:Dec 05, 2024

ApsaraDB for MongoDB provides many data restoration solutions.

Restore the instance data to an ApsaraDB for MongoDB instance

Important

When you restore the instance data to a new instance, take note of the following items:

  • The major version of the new instance must be the same as that of the original instance. You must select a zone based on the MongoDB version of the original instance. Instances of different MongoDB versions can be deployed in different zones. For more information about the limits on instance architectures, see Limits.

  • The storage space of the new instance must be larger than or equal to that of the original instance.

  • The backup data of an instance cannot be restored if the major version of the instance is upgraded after the backup data is generated.

  • By default, the new instance runs the latest kernel version.

Solution

Instance architecture

Restoration destination

Restoration range

Scenario

Restore the databases of an instance

Sharded cluster instance that uses cloud disks

Original instance

  • All databases

  • Partial databases

Applicable to scenarios where a collection or document is accidentally deleted.

Replica set or sharded cluster instance that uses local disks and runs MongoDB 3.4, MongoDB 4.0, or MongoDB 4.2

Note

For more information about limits such as the region limits, see Limits.

New Instance

Restore backup data to a new instance by backup point

  • Standalone instance

  • Replica set instance

New Instance

  • All databases

  • Partial databases

Note

You can restore partial databases only in an instance that uses local disks.

Applicable to scenarios where data timeliness is not a key requirement for the data restoration.

Restore backup data to a new instance by point in time

Replica set instance

New Instance

  • All databases

  • Partial databases

Note

You can restore partial databases only in an instance that uses local disks.

Applicable to scenarios where the instance data needs to be restored to a previous time point.

Sharded cluster instance

New Instance

All databases

Restore the instance data to a different region

  • Replica set instance that uses cloud disks

  • Sharded cluster instance that uses cloud disks

New Instance

All databases

Applicable to scenarios such as data monitoring or disaster recovery. You can use backup files to restore the instance data to a new instance in the region where the files are stored.

Restore the instance data to a self-managed database

To restore the data of an instance to a self-managed database, you must download the backup files of the instance to your computer. For more information about how to download backup files, see Download backup files.

Solution

Instance architecture

Remarks

Restore the instance data to a self-managed MongoDB database by using logical backup

  • Replica set instance that runs MongoDB 4.2 or earlier and uses local SSDs

  • Sharded cluster instance that runs MongoDB 4.2 or earlier and uses local SSDs

The mongorestore tool of an earlier version is not supported for ApsaraDB for MongoDB instances of later versions. We recommend that you select a mongorestore version that is compatible with the MongoDB version of your instance. For more information, see mongorestore.

Restore the instance data to a self-managed MongoDB database by using physical backup

Replica set instance that meets the following requirements:

  • The transparent data encryption (TDE) feature is not enabled for the instance. For more information about TDE, see Configure TDE for an instance.

  • The storage engine of the instance is WiredTiger or RocksDB.

N/A

FAQ

How do I restore the instance data that is generated at an earlier time point?

The time range to which the instance data can be restored depends on the specified retention period of the backup data. For more information about how to restore data generated at an earlier time point, see Retain the backup files of an instance for a long period of time.

How do I restore the backup data to the original instance?

For a sharded cluster instance that uses cloud disks, you can use the database and collection restoration feature to restore the instance data to the instance. For more information, see Restore the databases of an instance.

If the data of your instance fails to be restored to the instance by using the database and collection restoration feature, you can restore the backup data to a new instance and then modify the endpoint and port information of the original and new instances or use Data Transmission Service (DTS) to migrate data from the new instance to the original instance.

How do I migrate a downloaded backup file to an instance?

You cannot restore a downloaded backup file to an instance. To restore a downloaded backup file to an instance, restore the file to a self-managed database and then use DTS to migrate the file from the database to the instance. For more information about how to use DTS to migrate data, see Migrate data from a self-managed MongoDB database or an ApsaraDB for MongoDB instance.

How do I restore the instance data to a self-managed database if the instance architecture does not allow I to download backup files?

You can use DTS to migrate the instance data to a self-managed database. For more information about how to use DTS to migrate data, see Migrate data from a self-managed MongoDB database or an ApsaraDB for MongoDB instance.