ApsaraDB for MongoDB automatically backs up data based on a configurable backup policy. You can set the backup method, schedule, and retention period for an instance.
Prerequisites
An ApsaraDB for MongoDB standalone instance, replica set instance, or sharded cluster instance is created.
Considerations
-
If your instance runs a MongoDB version earlier than 4.0 and has more than 10,000 collections and indexes combined, Physical Backup may fail. Upgrade to MongoDB 4.0 or later to avoid this issue.
ImportantBackup files generated before the upgrade cannot be used to create new instances.
-
Only replica set instances that run MongoDB 4.4 or later support instant backup.
-
Only replica set instances and sharded cluster instances support log backup.
NoteYou cannot disable log backup for sharded cluster instances. If you disable log backup, point-in-time recovery becomes unavailable.
-
The log backup retention period cannot exceed the full backup retention period.
-
After you disable log backup, the existing log backup data is deleted and becomes unrecoverable.
Backup methods
ApsaraDB for MongoDB stores backup files in Object Storage Service (OSS). Backups do not consume instance storage.
The following table lists the backup methods for each instance type.
|
Instance type |
Backup method |
Description |
|
Snapshot Backup |
Captures the state of a disk at a specific point in time, enabling database restoration in minutes. Note
Backup consumes I/O resources of the instance. |
|
Physical Backup |
Backs up the physical database files of an instance. Note
|
Billing
ApsaraDB for MongoDB provides a free backup storage quota covering full and log backups. Backup storage within the quota incurs no charges. Excess usage is billed as: Hourly backup fee = (Backup storage usage - Free quota) × Unit price.
Free quota by storage type:
|
Storage type |
Free quota |
Usage and quota |
|
Cloud disk-based |
200% of the storage capacity |
View backup storage usage and free quota in the Specification Information section on the Basic Information page. |
|
Local disk-based |
50% of the storage capacity |
Unit prices for excess backup storage:
|
Storage type |
Unit price (CNY/GB/day) |
|
Cloud disk-based |
Varies by region:
|
|
Local disk-based |
Varies by region:
|
Full pricing details are available on the ApsaraDB for MongoDB pricing page.
Prices listed here are for reference only and may change. Check the purchase page and your bills for actual pricing.
Configure automatic backups
-
Go to the ApsaraDB for MongoDB replica set instances or ApsaraDB for MongoDB sharded cluster instances page. In the top navigation bar, select a resource group and a region. Then, click the ID of the target instance.
-
In the left-side navigation pane of the instance page, click Backup and Restoration.
-
Click the Backup Settings tab.
-
On the Backup Settings tab, click Edit and configure the following parameters.
Parameter
Description
Backup Method
Select Standard Backup or High-frequency Backup as needed.
This topic uses Standard Backup as an example. For High-frequency Backup parameters, see High-frequency backup.
Full Backup Retention Period (Days)
Number of days to retain full backups. Valid values: 7 to 730.
NoteFor instances purchased after September 10, 2021, the default is 30 days.
Backup Within Seconds
Enable or disable Backup Within Seconds. Disabled by default.
When enabled, backups complete within seconds.
NoteOnly replica set instances that run MongoDB 4.4 or later support instant backup.
Backed Up At
Backup time window.
Select an hourly time window. Schedule backups during off-peak hours.
NoteDisplayed in your local time zone.
Day of Week
Days of the week for backups. Default: daily.
NoteBack up at least twice a week for data security. Higher frequency reduces data loss and shortens recovery time.
Log Backup
Enable or disable Log Backup. Enabled by default.
-
Enabled: Oplogs are uploaded to OSS in real time and count toward backup billing. Enables point-in-time recovery to restore data to a new instance.
Note-
Set the log backup retention period. Click the Log Backup tab to view log backup details.
-
Only replica set and sharded cluster instances support log backup.
-
-
Disabled: No logs are uploaded to OSS and no log backup fees are incurred. Without oplogs, data can only be restored from the nearest full backup. Enable Log Backup for accurate point-in-time recovery.
ImportantAfter you disable log backup, the existing log backup data is deleted and becomes unrecoverable.
Log Backup Retention Period (Days)
Number of days to retain log backups when Log Backup is enabled. Valid values: 7 to 730. Default: 7.
NoteThe log backup retention period cannot exceed the full backup retention period.
-
-
Click OK.
FAQ
Related APIs
|
API |
Description |
|
Queries the backup policy of an instance. |
|
|
Modifies the backup policy of an instance. |