All Products
Search
Document Center

ApsaraDB for MongoDB:Download a backup file

Last Updated:Feb 11, 2025

If you want to retain ApsaraDB for MongoDB data for a long time, you can back up the data and then download it to your computer or restore it to a self-managed database. This method is applicable to scenarios such as business testing or data analysis. This topic describes how to download a backup file.

Prerequisites

Only the backup files of instances that run MongoDB 4.2 or earlier and use local disks can be downloaded.

Limits

You can download only physical backup files and logical backup files but not snapshot backup files.

Billing rules

You are not charged for downloading backup files by using a Public Connection String or Private Connection String.

Obtain the download URL of backup files

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which an 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. On the Full Backup tab, find the backup file that you want to download and then click Download in the Actions column.

  4. In the Download Backup dialog box, copy and record the Public Connection String or Private Connection String value.

  5. Click OK.

Download the backup file

Note

If your network connection is unstable, a timeout occurs when you use the copied Public Connection String to download the backup file. We recommend that you use the following methods:

  • If your Elastic Compute Service (ECS) instance and ApsaraDB for MongoDB instance are in the same region and use the same classic network or virtual private cloud (VPC), you can download the backup file by using the copied Private Connection String on the ECS instance.

  • Download the backup file on a client that supports the resumable download feature. For the Linux operating system, you can use the following wget command to download backup files.

Download the backup file in Windows or macOS

Paste the copied public endpoint into the address bar of your browser, and then press the Enter key to start the automatic download.

Download the backup file in Linux

Run the following command to download the backup file:

wget -c '<URL that is used to download the backup file>' -O <Name of the backup file><Suffix of the backup file>

Parameters:

  • -c: enables the resumable download feature.

  • -O: specifies the downloaded result as the file name.

  • <Suffix of the backup file>: generally sets the suffix of the backup file to _qp.xb or .tar.gz. Make sure that the suffix of the backup file is the same as that of 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

What do I do if my instance does not support the download of backup files?

If your instance does not support the download of backup files, you can perform the following operations based on the purpose of downloading backup files:

  • Restore backup data to a new ApsaraDB for MongoDB instance. If you want to restore backup data to a new ApsaraDB for MongoDB instance, you do not need to download backup files. For more information, see Restore the instance data to an ApsaraDB for MongoDB instance.

  • Restore backup data to a self-managed database or another ApsaraDB for MongoDB instance. If you want to restore backup data to a self-managed database or migrate the data to another ApsaraDB for MongoDB instance, you can use Data Transmission Service (DTS) to migrate the data. For more information, see Migrate data from a self-managed MongoDB database or an ApsaraDB for MongoDB instance.

  • Export backup data for retention. If you need only to export backup data for the long-time retention, you can use the mongodump tool. For more information, see mongodump.

What do I do if the download for a backup file with an excessive size is interrupted?

For the Linux operating system, you can add the -t 0 parameter to the wget command. This parameter and the -c parameter ensure that the wget command executes an unlimited number of resumable reconnections after the download is interrupted. For the Windows or macOS operating system, you can click "Continue Download" on the download management page of your browser after the download is interrupted.