All Products
Search
Document Center

ApsaraDB for MongoDB:High-frequency backup

Last Updated:Nov 15, 2023

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.

Prerequisites

  • A replica set or sharded cluster instance is used.

  • The instance runs MongoDB 4.4 or later.

  • The instance uses enhanced 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 based on 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

  1. Log on to the ApsaraDB for MongoDB console.

  2. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances.

  3. Click the ID of the instance or click Manage in the Actions column.

  4. In the left-side navigation pane of the instance details page, click Backup and Recovery.

  5. (Optional) On the Full Backup tab, click Upgrade to Cluster Backup Mode.

    Note

    To 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.

  6. 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, backup within seconds is enabled when the high-frequency backup feature is enabled.

    Note

    This parameter is valid only for replica set instances that run MongoDB 4.4 or later.

    Snapshot Backup Frequency

    The interval at which snapshot backups are performed.

    Note
    • The 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.

    Note

    For more information about how to configure other parameters on the Backup Settings page, see Configure automatic backup for an ApsaraDB for MongoDB instance.

Backup retention policies

High-frequency backup uses the snapshot backup method. Snapshot retention policies vary based on snapshot backup frequency.

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:

  • All snapshots that are generated within the last 1 hour are retained.

  • For snapshots that are generated more than 1 hour ago but within the last 24 hours, only the first snapshot that is generated on the hour is retained.

  • For snapshots that are generated more than 24 hours ago, only the first snapshot that is generated after 00:00 each day is retained.

If you set the snapshot backup frequency to 30 minutes, the following snapshot retention policies apply:

  • Two snapshots that are generated within the last 1 hour are retained.

  • For snapshots that are generated more than 1 hour ago but within the last 24 hours, only the 23 snapshots that are generated on the hour are retained.

  • For snapshots that are generated more than 24 hours ago, only the first snapshot that is generated after 00:00 each day is retained.

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:

  • All snapshots that are generated within the last 24 hours are retained.

  • For snapshots that are generated more than 24 hours ago, only the first snapshot that is generated after 00:00 each day is retained.

If you set the snapshot backup frequency to 6 hours, the following snapshot retention rules apply:

  • All four snapshots that are generated within the last 24 hours are retained.

  • For snapshots that are generated more than 24 hours ago but within the last week, only the first snapshot that is generated after 00:00 each day is retained.

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 but within the last week.

Related API operations

Operation

Description

DescribeBackupPolicy

Queries the backup policy of an ApsaraDB for MongoDB instance.

ModifyBackupPolicy

Modifies the backup policy of an ApsaraDB for MongoDB instance.