To ensure data security, ApsaraDB for MongoDB provides the high-frequency backup feature. You can configure high-frequency backup at an interval of several minutes or hours based on your business requirements. This topic describes how to configure high-frequency backup for an ApsaraDB for MongoDB instance.
Prerequisites
A replica set or sharded cluster instance is used.
The instance runs MongoDB 4.2 or later.
The instance uses Enterprise SSDs (ESSDs).
Billing
ApsaraDB for MongoDB provides a certain amount of free backup storage capacity. The backup storage capacity of an instance that uses ESSDs is calculated by using the following formula: 200% × instance storage capacity.
After the free quota is reached, the excess backup storage capacity is billed on a daily basis based on the unit price of backup storage. For more information, go to the Pricing tab of the ApsaraDB for MongoDB product page.
Enable the high-frequency backup feature
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.
(Optional) On the Full Backup tab, click Upgrade to Cluster Backup Mode.
NoteTo enable the high-frequency backup feature for sharded cluster instances that are created before October 19, 2023, you must switch the instances to the cluster backup mode. For replica set instances and sharded cluster instances that are created after October 19, 2023, skip this step.
Click the Backup Settings tab and configure the parameters described in the following table.
Parameter
Description
Backup Method
Select High-frequency Backup.
Full Backup Retention Period (Days)
The retention period of full backups. Valid values: 7 to 730. Default value: 30. Unit: day.
Backup Within Seconds
By default, the single-digit second backup feature is enabled when the high-frequency backup feature is enabled.
NoteThis parameter is valid only for replica set instances that use cloud disks.
Retention Period for High-frequency Backups (Days)
The retention period of high-frequency backups. Valid values: 1 to 7. Unit: day.
NoteThis parameter is valid only for sharded cluster instances that use cloud disks.
Snapshot Backup Frequency
The interval at which snapshot backups are performed.
NoteThe backup interval can be set to a period of 15 minutes to 12 hours for replica set instances.
The backup interval can be set to a period of 30 minutes to 12 hours for sharded cluster instances.
NoteFor more information about how to configure other parameters on the Backup Settings page, see Configure automatic backup for an instance.
Backup retention policies
High-frequency backup uses the snapshot backup method. The following tables describe the backup retention policies of replica set and sharded cluster instances.
Replica set instances
Snapshot retention policies for a replica set instance vary based on the snapshot backup frequency that you specify for the instance.
Snapshot backup frequency | Snapshot retention policy | Example |
Minutes | After the high-frequency backup feature is enabled, instance snapshots are retained based on the following policies:
| If you set the snapshot backup frequency to 30 minutes, the following snapshot retention policies apply:
As such, a maximum of 54 snapshots are retained within 30 days. The retained snapshots include 2 snapshots that are generated within the last 1 hour, 23 snapshots that are generated more than 1 hour ago but within the last 24 hours, and 29 snapshots that are generated more than 24 hours ago. |
Hours | After the high-frequency backup feature is enabled, instance snapshots are retained based on the following policies:
| If you set the snapshot backup frequency to 6 hours, the following snapshot retention policies apply:
As such, a maximum of 33 snapshots are retained within 30 days. The retained snapshots include 4 snapshots that are generated within the last 24 hours and 29 snapshots that are generated more than 24 hours ago. |
Sharded cluster instances
Snapshot retention policy | Example |
After the high-frequency backup feature is enabled, instance snapshots are retained based on the following policies:
| If you set the snapshot backup frequency to one hour and the retention period of high-frequency backups to 48 hours (two days), the following snapshot retention policies apply:
As such, a maximum of 76 snapshots are retained within 30 days. The retained snapshots include 48 snapshots that are generated within the last 48 hours and 28 snapshots that are generated more than 48 hours ago. |
FAQ
When is a backup task triggered after the high-frequency backup feature is enabled for an instance?
The instance triggers a backup task on the hour. For example, if you set the backup interval to 15 minutes, the instance triggers backup tasks at 00:00, 00:15, 00:30, 00:45, 01:00, and so on. If you set the backup interval to 1 hour, the instance triggers backup tasks at 00:00, 01:00, 02:00, 03:00, and so on. When you change the backup mode from regular backup to high-frequency backup for the instance, if the interval between the last backup time and the current time is greater than the high-frequency backup interval, a backup task is immediately triggered, and subsequent backup tasks are still triggered on the hour. Assume that the instance triggers a regular task at 09:00, you change the regular backup mode to the high-frequency backup mode at 09:20, and you set the backup interval to 15 minutes. A backup task is immediately triggered after the modification because 20 minutes have been elasped since the last backup. Subsequent backup tasks are still triggered on the hour. This means that the subsequent backup tasks are triggered at 09:20, 09:30, 09:45, 10:00, 10:15, 10:30, and so on.
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. |