You can retain the backup files of an ApsaraDB for MongoDB instance for a long period of time to restore your data and protect your data assets. This topic describes how to retain the backup files of an ApsaraDB for MongoDB instance for a long period of time.
Background information
When you use a database, the following issues may occur:
Your data is unexpectedly deleted. However, you have backed up only the data that was generated over the most recent seven days. As a result, you cannot restore the data.
Your instance is released due to unintended operations or overdue payments for a long period of time. As a result, you cannot recover your data or backup files.
Your instance needs to be released. However, you must retain the backup files of the instance for a long period of time.
Method 1: Extend the backup retention period
You can extend the retention period of backup files. This way, data that is generated within an earlier period of time can be restored.
After you extend the retention period of backup files, more backup files are retained. In this case, backup storage fees increase.
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the instance resides. Then, find the instance and click the ID of the instance.
In the left-side navigation pane of the instance details page, click Backup and Restoration.
Click Backup Settings.
In the Backup Settings panel, increase the values of the Full Backup Retention Period (Days) and Log Backup Retention Period (Days) parameters. For example, change the backup retention period from 7 days to 30 days.
NoteThe value of the Log Backup Retention Period (Days) parameter cannot be greater than that of the Full Backup Retention Period (Days) parameter.
For more information about other configuration items, see Configure automatic backup for an ApsaraDB for MongoDB instance.
Click OK.
Method 2: Configure the backup retention policy after an instance is released
Prerequisites
The ApsaraDB for MongoDB instance whose backup files you want to retain for a long period of time must meet the following requirements:
The instance is a replica set or sharded cluster instance.
The instance uses Enterprise SSDs (ESSDs) to store data.
Procedure
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the instance resides. Then, find the instance and click the ID of the instance.
In the left-side navigation pane of the instance details page, click Backup and Restoration.
Click Backup Settings.
In the Backup Settings panel, configure the Backup Retention Policy parameter.
Policy
Description
Delete all backup sets when you release the instance
For the first 7 days after the instance is released, the backup set used in the most recent backup is displayed in the recycle bin. You can migrate data to a new instance before the backup set is released.
Automatically back up data when you release the instance and retain the backup set for the instance for a long time
The backup set is retained for a long period of time, and the backup set used in the most recent backup is displayed in the recycle bin. You can migrate data to a new instance.
Automatically back up data when you release the instance and retain all backup sets for the instance for a long time
All backup sets are retained for a long period of time, and all backup sets used in the most recent backup are displayed in the recycle bin. You can migrate data to a new instance.
NoteAfter you configure the backup retention policy for an ApsaraDB for MongoDB instance, the backup files of the instance are retained based on the specified backup policy when the instance is released. You can go to the recycle bin to restore data or modify the backup retention policy. For more information about the recycle bin, see Recycle bin.
For more information about other configuration items, see Configure automatic backup for an ApsaraDB for MongoDB instance.
Click OK.
Method 3: Download backup files
You can download backup files to your computer or Elastic Compute Service (ECS) for long-term storage. For more information about ECS, see What is ECS?
Prerequisites
The ApsaraDB for MongoDB instance whose backup files you want to retain for a long period of time must meet the following requirements:
The major version of the instance is MongoDB 4.2 or earlier.
The instance uses local disks to store data.
The instance supports the physical backup method.
Procedure
For more information about how to download backup files, see Download backup files.