To restore a collection or document that was accidentally deleted, you can restore one or more databases of an ApsaraDB for MongoDB instance.
Prerequisites
- The instance must meet the following requirements:
- The instance was created after March 26, 2019.
- The instance is a replica set instance.
- The instance uses local disks to store data.
- The instance belongs to the China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Hangzhou), China (Shanghai), China (Shenzhen), or Singapore region.
- The instance runs MongoDB 3.4, 4.0, or 4.2. Note
- If the MongoDB version that your instance runs is outdated, upgrade the version. For more information, see Upgrade the major version of an ApsaraDB for MongoDB instance.
- After the upgrade, the instance backup files generated before the upgrade cannot be used to create instances.
- The storage engine of the instance is WiredTiger.
- Backup files contain the data of the databases to be restored. For example, if you want to restore the test database, the data of the test database must be included in the backup files.
Precautions
- You can restore one or more databases only from physical backups. If your instance runs MongoDB 3.4 and the total number of collections and indexes in your instance exceeds 10,000, physical backups may fail. Before you implement a physical backup, upgrade the MongoDB version of your instance to 4.0 or later. For more information about how to upgrade the database version, see Upgrade the major version of an ApsaraDB for MongoDB instance. Note After the upgrade, instance backup files that were generated before the upgrade cannot be used to create instances.
- The amount of time required to restore one or more databases varies based on factors such as data volume, task queue state, and network condition. When the state of the new instance changes to Running, the restoration is complete.
- If the minor version of an instance expires or is not included in the maintenance list, ApsaraDB for MongoDB automatically updates the minor version of the instance to the latest version when you perform the following operations. This ensures the performance and stability of the instance.
Billing
When you restore one or more databases, the system creates an instance and you are charged for this instance. For more information, see Billable items.
Procedure
- Log on to the ApsaraDB for MongoDB console.
- In the left-side navigation pane, click Replica Set Instances.
- In the upper-left corner of the page, select the resource group and region to which the instance belongs.
- Click the ID of an instance, or click
in the Actions column corresponding to the instance and select Manage.
- In the left-side navigation pane, click Backup and Recovery.
- Click the Full Backup tab.
- Use one of the following methods to restore databases:
- Create an instance by point in time
- Click Create Instance By Time Point.
- In the Create Instance By Time Point panel, configure the parameters described in the following table.
Parameter Description Select recovery time point Select a point in time from the last seven days from which to restore data. Note The point in time you select must be earlier than the current time and later than the time when the source instance was created.Select databases to recover Select Select Databases and then select the names of the databases that you want to restore. Note You can also click Enter Databases and enter the names of the databases that you want to restore. - Click OK.
- Create an instance from a backup point
- Find the backup file that you want to restore and click Create Instance from Backup Point in the Actions column.
- In the Create Instance from Backup Point
panel, select Select Databases and then select the databases that you want to restore. Note You can also click Enter Databases and enter the names of the databases that you want to restore.
- Click OK.
- Create an instance by point in time
- Configure the new instance.
- Confirm the order and complete the payment. Pay for the instance based on the its billing method.
- Subscription:
- Read and select the ApsaraDB for MongoDB Terms of Service and then click Buy Now.
- Click Pay. On the Purchase page, complete the payment.
- Pay-as-you-go: After you click Buy Now, the system automatically deducts the amount in the next hour.
- Subscription: