Download backup files

更新时间:
复制 MD 格式

For long-term storage of your ApsaraDB for MongoDB data, you can create backups and download the files to a local machine. These files can be restored to a self-managed database for business testing or data analytics. This topic explains how to download backup files.

Before you begin

  • You are not charged for failed tasks.

  • You cannot cancel a backup download task after it starts.

  • A cluster or instance can have only one running or failed download task at a time.

  • You cannot directly restore an ApsaraDB for MongoDB instance from a downloaded backup file. To restore an instance, see Restore an instance from a backup file.

Billing

  • For instances that use local disks, downloading backup files by using a Public Connection String or a Private Connection String is free of charge.

  • For instances that use cloud disks, downloading backups incurs outbound internet traffic and backup set conversion fees.

    Traffic fees

    • Internal network download: Free of charge.

    • Internet download: Each instance receives a free quota of 500 GB per month. Traffic that exceeds this quota is billed on a pay-as-you-go basis. You can view the downloaded traffic volume on the basic information page of your ApsaraDB for MongoDB instance. For more information about the pricing, see Network fees.

    • Billing point: Billing starts when the actual download begins after the backend task succeeds.

    • Cost savings: For large-volume downloads, we recommend that you purchase a subscription network plan to offset traffic costs.

    • Download to OSS: Additional OSS fees apply. To avoid ongoing storage charges, manually delete these files when you no longer need them.

    Backup set conversion fees

    When you use the download backup file feature for a cloud disk instance, you are charged for converting snapshot backups to BSON files. No free quota is available. The billing standard is as follows:

    Region

    Conversion fee (CNY/GB)

    Public cloud

    0.2

    Alibaba Finance Cloud/Microfinance Cloud

    0.38

    Alibaba Gov Cloud

    0.4

    Note

    When you download a snapshot backup for a cloud disk instance, the system creates a data conversion task. You are not charged a backup set conversion fee if this task fails.

Download backups for cloud disk instances

Prerequisites

Your ApsaraDB for MongoDB instance must meet the following requirements:

  • Architecture: replica set (excluding single-node instances) or sharded cluster.

  • Storage type: ESSD cloud disk.

  • Status: Running.

  • Region: The instance is in one of the supported public cloud regions: China (Chengdu), China (Guangzhou), China (Qingdao), China (Beijing), China (Shanghai), China (Zhangjiakou), China (Hangzhou), China (Shenzhen), China (Hong Kong), Malaysia (Kuala Lumpur), Indonesia (Jakarta), Japan (Tokyo), Singapore, Germany (Frankfurt), US (Silicon Valley), or US (Virginia).

  • Backup data is not encrypted.

  • If you use a RAM user, ensure the user has the required permissions to download backup files.

    How to grant permissions to a RAM user

    1. Log on to the RAM console by using your Alibaba Cloud account.

    2. In the left-side navigation pane, choose Permissions > Policies.

    3. Click Create Policy. On the JSON Editor tab, enter the following policy, and then click Confirm.

      {
        "Statement": [
          {
            "Effect": "Allow",
            "Action": "dds:Describe*",
            "Resource": "*"
          },
          {
            "Effect": "Allow",
            "Action": [
              "dbs:CreateDownload",
              "dbs:DescribeDBInstanceDownloadSize",
              "dbs:DescribeDownloadSupport"
            ],
            "Resource": "*"
          }
        ],
        "Version": "1"
      }
    4. In the Create Policy dialog box, enter a Name and Remarks for the policy. Confirm the policy content and click Confirm again.

    5. In the left-side navigation pane, choose Permissions > Authorize.

    6. Click Grant Permission and attach the policy that you created to the RAM user. For more information, see Grant permissions to a RAM user on the Authorization page.

    7. Click OK.

Supported and unsupported data

  • Unsupported:

    • The system databases admin, local, and config.

    • System collections whose names start with system..

    • Views and functions.

    • Time-series collections.

    • The download task fails if database or collection names contain forward slashes (/).

  • Supported: Non-time-series collections and index information.

Procedure

  1. Go to the backup list

    1. Go to the ApsaraDB for MongoDB Replica Set Instances page or the ApsaraDB for MongoDB Sharded Cluster Instances page. Select the resource group and region, and then click the ID of the target instance.

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

    3. On the Backup Download List tab, click Download Instance Backup File.

  2. Start a download task: On the Backup Download tab, click Download Instance Backup File.

  3. Configure parameters for instance backup download

    1. In the Point in Time and Backup Set step, select a Backup Set to download, and then click Next.

    2. In the Instance, Database, and Table step, retain the default settings to download the instance backup, and then click Next.

    3. In the Destination and Format step, configure the download destination and format.

      Destination

      Configuration

      OSS (Recommended)

      1. Select Write data to your OSS.

      2. Enter the bucket name and directory prefix of the destination OSS bucket.

        Only the Standard storage class is supported for OSS. To change the storage class, see Convert storage classes.

      3. Select a Download Format. The default format is BSON.

      4. If this is the first time you use this feature, click Go to Authorize > Agree to Authorization as prompted to grant ApsaraDB for MongoDB the permissions to access OSS.

      URL

      1. Select URL.

      2. Select a download format.

      3. After the task is successful, you must manually generate a download link. The link is valid for a limited period of time.

  4. Confirm and run the task: Read and agree to the terms, and then click Complete. You are redirected to the Backup Download List tab, where you can monitor the task status.

  5. Obtain the backup file

    • OSS method: Wait until the task status changes to Successful. The file is automatically stored in the specified OSS bucket and directory.

    • URL method: After the task status changes to Successful, click Generate Link in the Destination column within the 3-day validity period. Set a link validity period (from 5 minutes to 1 day; 2 hours by default) to get the download URL. When the task and link expire, the temporary data is automatically deleted, and you must start a new download task.

    Important

    Download tasks may fail due to temporary resource allocation failures during data conversion or because of unsupported data formats. If a task fails, we recommend that you first retry it or contact the Data Disaster Recovery technical support team.

  6. Use a command-line tool to download the file

    After obtaining the URL:

    • We recommend that you use a command-line tool, such as wget or curl, to download the file. For more information, see Appendix 1: Download commands in this topic.

    • For small files, you can copy the internet URL to the address bar of a browser to download the file.

Download backups for local disk instances

Prerequisites

  1. You can download backup files only for local disk instances that run MongoDB 4.2 or earlier.

  2. Only Physical Backup and Logical Backup files can be downloaded. Snapshot Backup backups cannot be downloaded. To download backup files from other instances, see What do I do if my instance does not support backup file downloads?.

Procedure

  1. Go to the backup list

    1. Go to the ApsaraDB for MongoDB Replica Set Instances page or the ApsaraDB for MongoDB Sharded Cluster Instances page. Select the resource group and region, and then click the ID of the target instance.

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

  2. Start a download task

    1. On the Full Backup tab, find the backup file that you want to download and click Download in the Actions column.

    2. In the Download Backup dialog box, Copy and take note of the Public Connection String or Private Connection String as needed.

    3. Click Confirm.

  3. Use a command-line tool to download the file

    After obtaining the URL:

    • We recommend that you use a command-line tool, such as wget or curl, to download the file. For more information, see Appendix 1: Download commands in this topic.

    • For small files, you can copy the internet URL to the address bar of a browser to download the file.

Appendix 1: Download commands

Note

If your network connection is unstable, downloading over the Public Connection String may time out. In this case, we recommend that you perform one of the following operations:

  • If your ECS instance and ApsaraDB for MongoDB instance are in the same region and both use the classic network, or if they are in the same VPC (with the same VPC ID), we recommend that you download the backup file to the ECS instance over the Private Connection String.

  • Use a client that supports resumable downloads. For Linux, you can use the wget command shown below to download backup files.

Download on Windows or macOS

Paste the download URL of the backup file into the address bar of a browser and press Enter. The browser automatically downloads the backup file.

Download on Linux

Run the following command to download a backup file:

wget -c '<Download URL of the backup file>' -O <Custom filename><Suffix>

Parameters:

  • -c: enables resumable download mode.

  • -O: saves the downloaded file with the specified filename.

  • <Suffix>: The file extension is typically _qp.xb or .tar.gz. Make sure that the extension is the same as that in the download URL.

Example:

wget -c 'http://rdsbak-hz-v3.oss-cn-hangzhou-internal.aliyuncs.com/custins5475****/hins1907****_data_20210906103710_qp.xb?Expires=......' -O backupfile._qp.xb

FAQ

Unsupported backup downloads

If your instance does not support backup file downloads, consider the following alternatives:

Interrupted downloads

On Linux, you can add the -t 0 parameter to the wget command together with the -c parameter. If the download is interrupted, wget retries indefinitely and resumes the download. On Windows and macOS, you can usually resume the download from the download management page of your browser.

403 Forbidden error

Check whether the download command is correct. Enclose the download URL in single quotation marks (').