All Products
Search
Document Center

ApsaraDB for MongoDB:Configure automatic backup for an instance

Last Updated:May 23, 2025

ApsaraDB for MongoDB automatically backs up the data of an instance based on a specified backup policy. This topic describes how to configure automatic backup for an ApsaraDB for MongoDB instance.

Prerequisites

A standalone instance, a replica set instance, or a sharded cluster instance is created.

Usage notes

  • If the engine version of your instance is earlier than MongoDB 4.0 and physical backup is used, physical backup may fail when the total number of collections and indexes in the instance exceeds 10,000. Before start a physical backup task, upgrade the engine version of your instance to MongoDB 4.0 or later. For more information, see Upgrade the major version of an instance.

    Important

    After the upgrade, instance backup files generated before the upgrade cannot be used to create instances.

  • The single-digit second backup feature can be enabled only for replica set instances that run MongoDB 4.4 or later.

  • The log backup feature can be enabled only for replica set and sharded cluster instances.

    Note

    The log backup feature cannot be disabled for sharded cluster instances. If the feature is disabled, data cannot be restored by point in time.

  • The retention period of log backup files cannot be longer than that of full backup files.

  • After the log backup feature is disabled, log backup files are deleted and cannot be restored.

Backup methods

ApsaraDB for MongoDB stores backup files in Object Storage Service (OSS) buckets instead of instances.

The following table describes the backup methods for instances of different architectures.

Instance architecture

Backup method

Description

  • Standalone instances

  • Replica set instances that use cloud disks

  • Sharded cluster instance that uses cloud disks

Snapshot backup

Snapshot backup retains disk data at a specific point in time and can be used to restore the data within minutes.

Note

Snapshot backup consumes the I/O resources of instances.

  • Replica set instances that use local disks

  • Sharded cluster instances that use local disks

Physical backup

Physical backup stores the physical database files of instances.

Note
  • Physical backup takes place in the hidden node of an instance, and the read and write performance of the primary and secondary nodes is not affected.

  • A long period time may be required to physically back up a large amount of data.

Billing rules

ApsaraDB for MongoDB provides free backup quotas. If your backup storage (full backup and log backup) falls within the free quota, you are not charged fees. For the excess backup storage, you are charged backup fees on an hourly basis. The backup fees are calculated based on the following formula: Backup fees per hour = (Backup storage - Free quota) × Unit price for backup files.

The following table describes the billing details.

Storage type

Free quota

View backup storage and free quota

Cloud disk-based instance

The free quota is equal to 200% of the storage that you purchase for your instance.

You can view the backup storage and free quota in the Specification Information section of the Basic Information page of your instance.

Local disk-based instance

The free quota is equal to 50% of the storage that you purchase for your instance.

The following table describes the billing details of the excess backup storage.

Storage type

Unit price of backup (USD per GB-day)

Cloud disk-based instances

The unit price varies in different regions:

  • Regions in the Chinese mainland: 0.0009375

  • China (Hong Kong) and regions outside the Chinese mainland: 0.001125

Local disk-based instances

The unit price varies in different regions:

  • Regions in the Chinese mainland: 0.00375

  • China (Hong Kong) and regions outside the Chinese mainland: 0.0045

For more information, go to Bill Detailsthe Pricing tab of the ApsaraDB for MongoDB product page.

Warning

The unit price of backup is for reference only. The unit price may change when you purchase an instance. The unit price generated in purchase inquiries and bills shall prevail.

Procedure

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the desired instance resides. Then, find the instance and click the instance ID.

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

  3. Click the Backup Settings tab.

  4. On the Backup Settings tab, click Edit and then configure the parameters described in the following table.

    Parameter

    Description

    Backup Method

    Select Standard Backup or High-frequency Backup.

    In this example, parameters related to Standard Backup are configured. For more information about parameters related to High-frequency Backup, see High-frequency backup.

    Full Backup Retention Period (Days)

    The retention period of full backup files. Valid values: 7 to 730. Unit: day.

    Note

    By default, this parameter is set to 30 for instances that are purchased after September 10, 2021.

    Backup Within Seconds

    Specifies whether to turn on Backup Within Seconds. By default, the single-digit second backup feature is disabled.

    If this feature is enabled, a backup operation can be completed within a few seconds.

    Note

    Single-digit second backup is available only for ApsaraDB for MongoDB replica set instances that run MongoDB 4.4 or later.

    Backed Up At

    The period of time during which you want backup tasks to be performed.

    We recommend that you specify an off-peak time period.

    Note

    The time range displayed is in the same time zone as that of the computer that you use to log on to the ApsaraDB for MongoDB console.

    Day of Week

    The frequency at which data is backed up. By default, data is backed up seven times per week.

    Note

    To ensure data security, you must set the backup frequency to at least two times per week. This accelerates data restoration in extreme cases.

    Log Backup

    Specifies whether to turn on Log Backup. By default, the log backup feature is enabled.

    • After the log backup feature is enabled, oplogs are uploaded to OSS buckets in real time and are billed. You can restore (clone) data to a new instance by using the point-in-time data restoration feature.

      Note
      • You can specify the retention period of backup logs and click the Log Backup tab to view the details of backup logs.

      • The log backup feature can be enabled only for replica set instances and sharded cluster instances.

    • After you disable the log backup feature, oplogs are not uploaded to OSS buckets and no log backup fees are incurred. In this case, oplogs are not retained, and the system selects the full backup files that are created at the point in time closest to the specified backup time for restoration. To ensure the accuracy of point-in-time data restoration, we recommend that you turn on Log Backup.

      Important

      After the log backup feature is disabled, log backup files are deleted and cannot be restored.

    Log Backup Retention Period (Days)

    If you turn on Log Backup, you must specify the retention period of log backup files. Valid values: 7 to 730. Default value: 7. Unit: day.

    Note

    The retention period of log backup files cannot be longer than the retention period of full backup files.

  5. Click OK.

FAQ

How do I view the fees incurred for instance backup?

You can view the bills of the Backup Storage Size billable item on the Billing Details tab of the page.

How do I manually delete the backup files of my instance?

You cannot manually delete the backup files of your instance. To ensure that the system automatically deletes the backup files, you can modify the backup policy configured for your instance. For example, you can reduce the backup frequency or the backup retention period. For more information, see Procedure.

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.