ApsaraDB for MongoDB automatically backs up the data of an instance based on a specified backup policy. This topic describes how to configure automatic backup for an ApsaraDB for MongoDB instance.
Prerequisites
A standalone instance, a replica set instance, or a sharded cluster instance is created.
Usage notes
If the database engine version of your instance is earlier than MongoDB 4.0 and the physical backup method is used, physical backups may fail when the total number of collections and indexes in the instance exceeds 10,000. Before a physical backup task is executed, you can upgrade the database engine version of your instance to MongoDB 4.0 or later. For more information, see Upgrade the major version of an ApsaraDB for MongoDB instance.
ImportantAfter the upgrade, instance backup files that are generated before the upgrade cannot be used to create instances.
The single-digit second backup feature can be enabled only for ApsaraDB for MongoDB replica set instances that run MongoDB 4.4 or later.
The log backup feature can be enabled only for replica set instances and sharded cluster instances.
NoteThe log backup feature cannot be disabled for sharded cluster instances. If the feature is disabled, data cannot be restored by point in time.
The retention period of log backups cannot be longer than the retention period of full backups.
After the log backup feature is disabled, log backups are deleted and cannot be restored.
Backup methods
ApsaraDB for MongoDB stores backup files in Object Storage Service (OSS) buckets instead of ApsaraDB for MongoDB instances.
The following table describes the backup methods for instances of different architectures.
Instance architecture | Backup method | Description |
| Snapshot backup | Snapshot backup retains disk data at a specific point in time and can be used to restore the data within minutes. Note Snapshot backup consumes the I/O resources of instances. |
| Physical backup | Physical backup stores the physical database files of instances. Note
|
Billing rules
ApsaraDB for MongoDB provides free backup quotas. If your backup storage (full backup and log backup) falls within the free quota, you are not charged fees. For the excess backup storage, you are charged backup fees on an hourly basis. The backup fees are calculated based on the following formula: Backup fees per hour = (Backup storage - Free quota) × Unit price for backup files.
The following table describes the billing details.
Storage type | Free quota | View backup storage and free quota |
Instances that use cloud disks | The free quota is equal to 200% of the storage that you purchase for your instance. | You can view the backup storage and free quota in the Specification Information section of the Basic Information page of your instance. |
Instances that use local disks | The free quota is equal to 50% of the storage that you purchase for your instance. |
The following table describes the billing details of the excess backup storage.
Storage type | Unit price of backup (USD per GB-day) |
Instances that use cloud disks | The unit price varies in different regions:
|
Instances that use local disks | The unit price varies in different regions:
|
For more information, go to the Pricing tab of the ApsaraDB for MongoDB product page.
The unit price of backup is for reference only. The unit price may change when you purchase an instance. The unit price generated in purchase inquiries and bills shall prevail.
Procedure
Log on to the ApsaraDB for MongoDB console.
In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances.
In the upper-left corner of the page, select the resource group and region to which the instance belongs.
Click the ID of the instance that you want to manage or click Manage in the Actions column.
In the left-side navigation pane of the instance details page, click Backup and Restoration.
On the Full Backup tab, configure a backup policy.
Click Backup Settings.
In the Backup Settings panel, configure the parameters described in the following table.
Parameter
Description
Backup Method
Select Standard Backup or High-frequency Backup.
In this example, parameters related to Standard Backup are configured. For more information about parameters related to High-frequency Backup, see High-frequency backup.
Full Backup Retention Period (Days)
The retention period of full backups. Valid values: 7 to 730. Unit: day.
NoteBy default, this parameter is set to 30 for instances that are purchased after September 10, 2021.
Backup Within Seconds
Specifies whether to turn on Backup Within Seconds. By default, the single-digit second backup feature is disabled.
If this feature is enabled, a backup operation can be completed within a few seconds.
NoteSingle-digit second backup is available only for ApsaraDB for MongoDB replica set instances that run MongoDB 4.4 or later.
Backed Up At
The period of time during which you want backup tasks to be performed.
We recommend that you specify an off-peak time period.
NoteThe time range displayed is in the same time zone as that of the computer that you use to log on to the ApsaraDB for MongoDB console.
Day of Week
The frequency at which data is backed up. By default, data is backed up seven times per week.
NoteTo ensure data security, you must set the backup frequency to at least two times per week. This accelerates data restoration in extreme cases.
Log Backup
Specifies whether to turn on Log Backup. By default, the log backup feature is enabled.
After the log backup feature is enabled, oplogs are uploaded to OSS buckets in real time and are billed. You can restore (clone) data to a new instance by using the point-in-time data restoration feature.
NoteYou can specify the retention period of backup logs and click the Log Backup tab to view the details of backup logs.
Log backup is available only for replica set and sharded cluster instances.
After you disable the log backup feature, oplogs are not uploaded to OSS buckets and no log backup fees are incurred. In this case, oplogs are not retained, and the system selects the full backups that are created at the point in time closest to the specified backup time for restoration. To ensure the accuracy of point-in-time data restoration, we recommend that you turn on Log Backup.
ImportantAfter the log backup feature is disabled, log backups are deleted and cannot be restored.
Log Backup Retention Period (Days)
If you turn on Log Backup, you must specify the retention period of log backups. Valid values: 7 to 730. Default value: 7. Unit: day.
NoteThe retention period of log backups cannot be longer than the retention period of full backups.
Click OK.
FAQ
How do I view the fees incurred for instance backup?
You can view the bills of the Backup Storage Size billable item on the Billing Details tab of the Bill Details page.
Related API operations
Operation | Description |
Queries the backup policy of an ApsaraDB for MongoDB instance. | |
Modifies the backup policy of an ApsaraDB for MongoDB instance. |