All Products
Search
Document Center

ApsaraDB for MongoDB:Configure high-frequency backup for an instance

Last Updated:Nov 12, 2024

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 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 Enterprise SSDs (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

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

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

  3. (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.

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

    Note

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

    Note

    This parameter is valid only for sharded cluster instances that use cloud disks.

    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 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:

  • 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 policies apply:

  • All four 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.

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:

  • All snapshots that are generated within the specified retention period of high-frequency backups are retained.

  • For snapshots that are generated beyond the specified retention period of high-frequency backups, only the first snapshot that is generated after 00:00 each day is retained.

If you set the snapshot backup frequency to one hour and the retention period of high-frequency backups to two days, the following snapshot retention policies apply:

  • 48 snapshots that are generated within the last 48 hours (two days) are retained.

  • For snapshots that are generated more than 48 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 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 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.