ApsaraDB for MongoDB automatically backs up your instance data according to a customizable backup policy. This topic explains how to configure automatic backups, including backup methods, scheduling, retention periods, and cost optimization.
Prerequisites
You have created a MongoDB instance (standalone, replica set, or sharded cluster).
Usage notes
Version and instance requirements
For instances running MongoDB versions earlier than 4.0, High-frequency Backup may fail if your instance has more than 10,000 collections and indexes combined. We recommend upgrading to MongoDB 4.0 or later before enabling this feature. For more information, see Upgrade the major database version.
ImportantBackup files created before upgrading to MongoDB 4.0 cannot be used to restore or clone instances after the upgrade.
The instant backup feature (Backup Within Seconds) is available only for replica set instances running MongoDB 4.4 or later.
Log backup (required for point-in-time recovery) is supported only for replica set and sharded cluster instances.
NoteFor sharded cluster instances, log backup is always enabled and cannot be disabled. Disabling log backup on replica sets prevents point-in-time recovery.
Configuration constraints
Log backup retention period cannot exceed the full backup retention period.
Critical warnings
Disabling log backup permanently deletes all existing log backup files. This action cannot be undone.
Backup methods
ApsaraDB for MongoDB offers two backup methods optimized for different instance types. All backup files are stored in Object Storage Service (OSS) for durability and are separate from your instance storage.
The backup method available depends on your instance architecture and disk type:
Architecture | Backup method | Description |
| Snapshot Backup | Uses disk snapshots to capture your database state at a specific point in time. Restoration from snapshot backup typically completes within minutes. Note Note: Standard Backup temporarily consumes instance I/O resources during the backup process. |
| Physical Backup | Creates physical copies of your database files. Note
|
Costs
ApsaraDB for MongoDB includes generous free backup storage quotas. You're only charged for backup storage that exceeds your free quota, calculated hourly using this formula: Hourly backup cost = (Total backup storage - Free quota) × Unit price.
View your current backup storage usage and free quota allocation:
Storage type | Free quota | View backup storage and free quota |
Cloud disk instances | 200% of your purchased storage capacity | View your current backup storage usage and free quota on the Basic Information page, under the Specification Information section. |
Local disk instances | 50% of your purchased storage capacity |
Backup storage pricing for usage beyond your free quota:
Storage type | Unit price of backup (USD per GB-day) |
Cloud disk-based instances | The unit price varies in different regions:
|
Local disk-based instances | The unit price varies in different regions:
|
For detailed pricing information, visit the ApsaraDB for MongoDB Pricing page.
Prices shown are for reference only. Actual billing rates are determined at purchase time and reflected in your bills.
Procedure
Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the resource group and region to which the desired instance belongs. Then, find the instance and click the instance ID.
In the left-side navigation pane of the instance details page, click Backup and Restoration.
Click the Backup Settings tab.
On the Backup Settings tab, click Edit and then configure the parameters described in the following table.
Parameter
Description
Backup Method
Choose between Standard Backup or High-frequency Backup.
This guide focuses on Standard Backup configuration. For High-frequency Backup settings, refer to High-frequency backup.
Full Backup Retention Period (Days)
Specify how long to retain full backup files. Valid range: 7 to 730 days.
NoteDefault: 30 days for instances created after September 10, 2021.
Backup Within Seconds
Enable Backup Within Seconds to complete backups in just seconds instead of minutes. This feature is disabled by default.
When enabled, backup operations complete within a few seconds, minimizing any potential performance impact.
NoteAvailable only for replica set instances running MongoDB 4.4 or later.
Backed Up At
Select the time window when backups should run. We strongly recommend choosing off-peak hours to minimize impact on your application.
NoteBackup times are displayed in your local computer's time zone.
Day of Week
Select which days of the week to run backups. By default, backups run daily (all seven days selected).
NoteFor data security, schedule backups at least twice weekly. More frequent backups enable faster recovery.
Log Backup
Enable Log Backup for point-in-time recovery (PITR) capability. This feature is enabled by default.
When enabled, MongoDB oplogs are continuously uploaded to OSS for real-time backup. This allows you to restore your instance to any specific point in time within your retention period. Additional storage charges apply for log backups.
NoteConfigure the log backup retention period below, and view log backup details on the Log Backup tab.
Log backup is supported only for replica set and sharded cluster instances.
When disabled, oplogs are not backed up to OSS (no log backup charges). However, without log backups, point-in-time recovery is not available. The system will restore from the full backup closest to your requested time, which may result in data loss. We strongly recommend keeping Log Backup enabled for production databases.
WarningDisabling log backup immediately and permanently deletes all existing log backup files. This action cannot be undone.
Log Backup Retention Period (Days)
If log backup is enabled, specify the retention period for log files. Valid range: 7 to 730 days. Default: 7 days.
NoteLog backup retention cannot exceed your full backup retention period.
Click OK.
FAQ
Related APIs
Operation | Description |
Retrieves the current backup policy configuration for an instance. | |
Updates the backup policy configuration for an instance. |