All Products
Search
Document Center

ApsaraDB for MongoDB:Configure automatic backup for an instance

Last Updated:Nov 04, 2024

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 database engine version of your instance is earlier than MongoDB 4.0 and the physical backup method is used, physical backups may fail when the total number of collections and indexes in the instance exceeds 10,000. Before a physical backup task is executed, you can upgrade the database engine version of your instance to MongoDB 4.0 or later. For more information, see Upgrade the major version of an ApsaraDB for MongoDB instance.

    Important

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

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

  • The log backup feature can be enabled only for replica set instances 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 backups cannot be longer than the retention period of full backups.

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

Backup methods

ApsaraDB for MongoDB stores backup files in Object Storage Service (OSS) buckets instead of ApsaraDB for MongoDB 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 instances that use 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

Instances that use cloud disks

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.

Instances that use local disks

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)

Instances that use cloud disks

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

Instances that use local disks

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 the 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. Log on to the ApsaraDB for MongoDB console.

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

  3. In the upper-left corner of the page, select the resource group and region to which the instance belongs.

  4. Click the ID of the instance that you want to manage or click Manage in the Actions column.

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

  6. On the Full Backup tab, configure a backup policy.

    1. Click Backup Settings.

    2. In the Backup Settings panel, 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 backups. 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.

        • Log backup is available only for replica set 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 backups 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 backups 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 backups. Valid values: 7 to 730. Default value: 7. Unit: day.

      Note

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

    3. 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 Bill Details page.

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.