ApsaraDB for MongoDB automatically backs up an instance by using a backup policy. You can also select a backup method to manually back up an ApsaraDB for MongoDB instance. This topic describes how to manually back up an ApsaraDB for MongoDB instance.

Prerequisites

An ApsaraDB for MongoDB standalone, replica set, or sharded cluster instance is created.

Background information

ApsaraDB for MongoDB stores backup files in Object Storage Service (OSS) to reduce the storage usage of ApsaraDB for MongoDB instances. For more information about OSS, see What is OSS?

Manual backup

  • ApsaraDB for MongoDB provides the following backup methods:
    • Snapshot Backup: The state of disk data at a specific point in time is retained. This method allows data in a database to be restored within minutes.
    • Logical Backup: The mongodump tool is used to store operation records of databases in a logical backup file. This method restores data in the form of playback commands during restoration.
    • Physical Backup: Physical database files of an ApsaraDB for MongoDB instance are backed up. This method provides faster backup and restoration than logical backup.
  • The following table describes the backup methods for ApsaraDB for MongoDB instances of different architectures.
    Architecture Backup method
    • Standalone instance
    • Replica set instance that runs MongoDB 5.0 and 4.4
    Snapshot Backup
    Note Snapshot backup affects the I/O performance of ApsaraDB for MongoDB instances.
    • Replica set instance that runs MongoDB 4.2 or earlier
    • Sharded cluster instance
    • Logical Backup
    • Physical Backup
    Note
    • Physical backup and logical backup take place in the hidden node of an ApsaraDB for MongoDB instance, and the read and write performance of the primary and secondary nodes is not affected.
    • If the amount of data to be backed up is large, the backup process requires a long period of time.

Billing

ApsaraDB for MongoDB provides a free quota for backup storage. After the free quota is reached, you are charged on a pay-as-you-go basis. For more information, visit ApsaraDB for MongoDB Pricing.

Billing rules of backup storage after the free quota is exceeded
  • Dedicated cloud-disk instances: You are charged for backup on a pay-as-you-go basis when your consumed storage exceeds 200% of the instance storage capacity.
  • Dedicated local-disk instances: You are charged for backup on a pay-as-you-go basis when your consumed storage exceeds 50% of the instance storage capacity.

Precautions

If the database version of your ApsaraDB for MongoDB instance is earlier than MongoDB 4.0 and the backup method is set to Physical Backup, physical backups may fail when the total number of collections and indexes exceeds 10,000. Before you implement a physical backup, upgrade the database version of your instance to MongoDB 4.0 or later. For more information about how to upgrade the database version, see Upgrade MongoDB versions.
Note After the database version is upgraded, the backup files of the source instance cannot be used to restore data to the new instance.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. In the left-side navigation pane, click Replica Set Instances, or Sharded Cluster Instances based on the instance type.
  4. Find the target instance and click its ID.
  5. In the upper-right corner of the page, click Back up Instance.
  6. In the Back up Instance panel, set Backup Method.
    Note
    • Snapshot Backup is supported for replica set instances that run MongoDB 4.4 and standalone instances.
    • Logical Backup and Physical Backup are supported for replica set instances that run MongoDB 4.2 or earlier and sharded cluster instances.
  7. Click OK.

FAQ

How do I view the fees incurred for instance backup?

You can perform the following steps to view the fees:
  1. Log on to the User Center homepage.
  2. In the left-side navigation pane, choose Bill > Bill.
  3. Click the Details tab.
  4. Find BackupStorageSize in the Billing Item column. This is the fees incurred for instance backup.

Related API operations

Operation Description
CreateBackup Manually backs up an ApsaraDB for MongoDB instance.