High-frequency backup

更新时间:
复制 MD 格式

To ensure data security, ApsaraDB for MongoDB provides the high-frequency backup feature, allowing you to create backups at minute or hour intervals. This topic describes how to configure this feature.

Prerequisites

  • The instance is a replica set or a sharded cluster.

  • The instance runs MongoDB 4.2 or later.

  • The instance uses ESSDs.

Billing

ApsaraDB for MongoDB provides a free backup storage quota. For an instance that uses ESSDs, the free quota is 200% of the instance's storage capacity.

If you exceed the free quota, the excess storage is billed daily based on its unit price. For more information, see the ApsaraDB for MongoDB pricing page.

Enable high-frequency backup

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select a resource group and region, and then click the ID of the target instance.

  2. In the left-side navigation pane, click Backup and Restoration.

  3. (Optional) On the Full Backup tab, click Upgrade to Cluster Backup Mode on the right.

    Note

    For sharded cluster instances that run MongoDB 4.4 and were created before October 19, 2023, you must switch to cluster backup mode to enable high-frequency backup. You can skip this step for replica set instances and for sharded cluster instances created on or after October 19, 2023.

  4. Click the Backup Settings tab.

  5. On the Backup Settings tab, click Edit and configure the following parameters.

    Parameter

    Description

    Backup Method

    Select High-frequency Backup.

    Retention Period for High-frequency Backups (Days)

    The number of days to retain high-frequency backups. Valid values: 1 to 7.

    Hour Sparse Backup

    Specifies whether to enable hourly sparse backup when the snapshot backup frequency is set to minutes:

    • Enable: When the backup frequency is set to minutes, all snapshots from the last hour are retained. For snapshots older than one hour but within the Retention Period for High-frequency Backups (Days), only the first snapshot of each hour is retained.

    • Disable: All snapshots within the Retention Period for High-frequency Backups (Days) are retained.

    Full Backup Retention Period (Days)

    The number of days to retain full backup data. Valid values: 7 to 730. The default value is 30.

    Backup Within Seconds

    The second-level backup feature is enabled by default when you enable high-frequency backup.

    Note

    This parameter is available only for replica set instances that use ESSDs.

    Snapshot Backup Frequency

    The frequency of backups.

    Note
    • For replica set instances, the backup frequency can be set to intervals from 15 minutes to 12 hours.

    • For sharded cluster instances, the backup frequency can be set to intervals from 30 minutes to 12 hours.

    Note

    For information about other parameters on the Backup Settings page, see Configure automatic backup for an instance.

Backup retention policy

The Backup Method used for high-frequency backup is Snapshot Backup. The backup retention policy and examples are as follows.

Snapshot frequency

Hourly sparse backup

Retention policy

Example

Minute-level frequency

Enabled

  • All snapshots from the last hour are retained.

  • For snapshots older than one hour but within the high-frequency backup retention period, only the first snapshot of each hour is retained.

  • For snapshots older than the high-frequency backup retention period, only the first snapshot created after 00:00 each day is retained.

Assume the snapshot frequency is 30 minutes, the high-frequency backup retention period is 2 days, and the full backup retention period is 30 days:

  • The two snapshots from the last hour are retained.

  • For snapshots older than one hour but within the 2-day period, only the first snapshot of each hour is retained, for a total of 47 snapshots.

  • For snapshots older than 2 days, only the first snapshot after 00:00 each day is retained, for a total of 28 snapshots.

In total, a maximum of 77 snapshots are stored within 30 days (2 snapshots from the last hour + 47 snapshots from the rest of the 2-day period + 28 snapshots from the remaining days).

Disabled

  • All snapshots within the high-frequency backup retention period are retained.

  • For snapshots older than the high-frequency backup retention period, only the first snapshot after 00:00 each day is retained.

Assume the snapshot frequency is 30 minutes, the high-frequency backup retention period is 2 days, and the full backup retention period is 30 days:

  • All 96 snapshots from the last 2 days are retained.

  • For snapshots older than 2 days, only the first snapshot after 00:00 each day is retained, for a total of 28 snapshots.

In total, a maximum of 124 snapshots are stored within 30 days (96 snapshots from the last 2 days + 28 snapshots from the remaining days).

Hour-level frequency

Not applicable

  • All snapshots within the high-frequency backup retention period are retained.

  • For snapshots older than the high-frequency backup retention period, only the first snapshot after 00:00 each day is retained.

Assume the snapshot frequency is every 6 hours, the high-frequency backup retention period is 2 days, and the full backup retention period is 30 days:

  • All 8 snapshots from the last 2 days are retained.

  • For snapshots older than 2 days, only the first snapshot after 00:00 each day is retained, for a total of 28 snapshots.

In total, if the snapshot frequency is set to every 6 hours, a maximum of 36 snapshots are stored within 30 days (8 snapshots from the last 2 days + 28 snapshots from the remaining days).

FAQ

After I enable high-frequency backup, when are backup tasks triggered?

High-frequency backups are triggered on a fixed schedule based on the hour. For example, if the frequency is 15 minutes, tasks are triggered at 00:00, 00:15, 00:30, 00:45, 01:00, and so on. If the frequency is 1 hour, tasks are triggered at 00:00, 01:00, 02:00, 03:00, and so on. When you switch from a standard backup policy to a high-frequency one, the system may trigger an immediate backup. This happens if the time elapsed since the last backup is greater than the new high-frequency interval. After this initial backup, subsequent tasks follow the fixed schedule. For example, assume a standard backup ran at 09:00. At 09:20, you switch to a high-frequency backup policy with a 15-minute interval. Because more than 15 minutes have passed since the last backup, a new backup is triggered immediately at 09:20. Subsequent backups then follow the fixed schedule at 09:30, 09:45, 10:00, and so on.

Do frequent backup tasks affect instance performance after high-frequency backup is enabled?

The high-frequency backup feature is available only for instances that use ESSDs. The impact on instance performance is minimal for the following reasons:

  • Backup execution node: Backups are performed only on secondary or hidden nodes and do not affect the primary node.

  • Physical backup optimization: High-frequency backup relies on physical backups at the kernel level. ApsaraDB for MongoDB has optimized this process to avoid resource-intensive operations such as fsync or writing a new checkpoint.

  • ESSD snapshot overhead: Creating an ESSD snapshot has minimal overhead. For more information about its principles and implementation, see Snapshot overview.

API reference

API

Description

DescribeBackupPolicy

Queries the backup policy of an ApsaraDB for MongoDB instance.

ModifyBackupPolicy

Modifies the backup policy of an ApsaraDB for MongoDB instance.