All Products
Search
Document Center

Data Management:Logical backup and restore for self-managed or cross-cloud MongoDB

Last Updated:Jun 17, 2026

Database Backup Service (DBS) supports collection-level restore, geo-redundant backup, full or incremental backup, and long-term archiving for MongoDB databases. You can use DBS to automate the backup of self-managed or cross-cloud MongoDB databases.

Create a backup schedule

For more information, see Create a backup schedule.

Note
  • When you purchase a backup schedule, set the Database Type to MongoDB and the Backup Mode to Logical Backup.

  • For information about the backup and restore granularity for MongoDB databases, see Supported database types and features.

Configure the backup schedule

  1. Log on to the Data Management Service (DMS) 5.0 console.

  2. In the top navigation bar, choose Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

  3. Find the target backup schedule and click Configure Backup Schedule in the Actions column.

  4. On the Configure Backup Source and Destination page, configure the backup source and destination, and then click Next.

    Section

    Parameter

    Description

    N/A

    Backup schedule name

    DBS automatically generates a schedule name. You can specify a descriptive name to identify the schedule. The name does not need to be unique.

    Backup source information

    Backup mode

    Currently, only logical backup is supported.

    Database location

    • No public network IP: Port's self-built database (accessed through the database gateway): Backs up a self-managed database by using Database Gateway (DG). You must first configure a database gateway for the instance and then select the corresponding DG instance ID.

    • User-Created Database with Public IP Address <IP Address:Port Number>: Backs up a self-managed database over a public network. You must also configure the endpoint and port of the source database instance.

    • ECS-Hosted Database: Backs up a database that is hosted on an ECS instance. You must also configure the ECS instance ID and the database port for the source database instance.

    • Express Connect DB/VPN Gateway/Intelligent Gateway: Backs up a self-managed database by using a Virtual Private Cloud (VPC). You must configure a VPC for the database instance in advance and select the target Peer VPC in this step.

    Database type

    The value is the same as the database type you selected when you created the backup schedule.

    Note

    This parameter is not displayed if you set the Database location parameter to ApsaraDB for MongoDB.

    Peer VPC

    Select the Virtual Private Cloud (VPC).

    Note

    This parameter is displayed only if you set the Database location parameter to Self-managed database accessed via Express Connect, VPN Gateway, or Smart Access Gateway (SAG).

    Secondary node endpoint

    Specify whether to configure the endpoint of a secondary node so that the system performs a full backup by reading data from the secondary node.

    Note

    For more information, see Back up a MongoDB database from a secondary node.

    Region

    Select the region of the source instance.

    Note

    This parameter is displayed only if you set the Database location parameter to ECS-hosted database, ApsaraDB for MongoDB, or Self-managed database without a public endpoint (accessed via Database Gateway).

    Endpoint

    The public endpoint of the source database.

    Note

    This parameter is displayed only if you set the Database location parameter to Self-managed database with a public endpoint, Self-managed database accessed via Express Connect, VPN Gateway, or Smart Access Gateway (SAG), or Self-managed database without a public endpoint (accessed via Database Gateway).

    Port

    The port used to connect to the source database.

    Note

    This parameter is not displayed if you set the Database location parameter to ApsaraDB for MongoDB.

    ECS instance ID

    Select the ID of the ECS instance that hosts the source database.

    Note

    This parameter is displayed only if you set the Database location parameter to ECS-hosted database.

    DG instance ID

    Select the Database Gateway (DG) instance.

    Note

    This parameter is displayed only if you set the Database location parameter to Self-managed database without a public endpoint (accessed via Database Gateway).

    Database name

    Enter the name of the database.

    Database account

    Enter the database account.

    Note

    Make sure the account has read permissions on the local database.

    Password

    The password of the account that is used to connect to the database that you want to back up.

    After you enter the username and password of the database account, click Test Connection next to the password to check whether the information about the database that you want to back up is valid. If the specified parameters are valid, the Test Passed message is displayed. If the Test Failed message is displayed, click Check next to Test Failed. Modify the information about the database that you want to back up based on the check results.

    Compliance warranty regarding cross-border data transfers

    Read and agree to the compliance commitment by selecting the check box.

    Backup Destination Information

    Backup storage type

    The storage type of the backup destination. Valid values:

    • DBS-owned Storage (Recommended): No manual storage creation required. Data is automatically stored in DBS-owned storage, and fees are based on the amount of stored data. For more information, see Storage fees.

    • OSS For User: You must create a bucket in the Object Storage Service (OSS) console. For more information, see Create buckets.

    Note
    • This example uses DBS-owned Storage. If you select User-owned OSS bucket, you must also configure the Object Storage Service (OSS) Bucket Name parameter. Only the OSS Standard storage class is supported.

    • For large volumes of data, consider purchasing a subscription DBS storage plan. Subscription plans are more cost-effective than pay-as-you-go billing.

    Storage encryption

    Select an encryption method. Valid values:

    • Encrypted (Recommended): Encrypts stored data by using the industry-standard AES-256 algorithm.

      OSS supports server-side encryption. When you upload an object, OSS encrypts it upon receipt before saving. When you download the object, OSS automatically decrypts it. For more information, see Server-side encryption.

    • Non-encrypted: Does not encrypt data.

  5. On the Edit Backup Objects page, move the databases or collections that you want to back up to the Selected box, and then click Next.

    Note
    • You can back up a single collection, a single database, or multiple databases. You can click Select All in the lower-left corner to select all existing databases. The supported backup objects vary for different databases. For more information, see Supported database types and features.

    • By default, the backup schedule does not include databases created after its configuration. To back up these new databases, you must add them to the backup schedule. For more information, see Modify backup objects.

  6. On the Configure Backup Time page, configure the backup time and other parameters, and then click Next.

    Parameter

    Description

    Full backup frequency

    The frequency of the backup schedule. Valid values: Periodic Backup and Single Backup.

    Note

    If you select Periodic Backup, you must configure the Full Data Backup Recurrence and Start At parameters.

    Full backup period

    The days of the week on which DBS runs the backup schedule. You can select one or more days of a week. Select at least one day of the week.

    Start time

    The start time of the backup. We recommend that you set a point in time within off-peak hours. Example: 01:00.

    Note

    If a previous full data backup is not finished at the start time of the next backup, DBS skips the next backup.

    Incremental backup

    Specifies whether to enable incremental backup.

    This parameter is displayed only if you set the Full-scale Backup Frequency parameter to Periodic Backup.

    Max concurrent threads for full backup

    The maximum number of concurrent threads available for a full backup. You can set this parameter to adjust the backup speed. For example, you can reduce the number of backup threads to minimize impacts on the database.

  7. On the Edit Lifecycle page, specify the retention period for full backup data in the DBS-owned storage.

    If you enabled Incremental backup in the previous step, you must also configure the retention period for incremental backup data. For more information about the lifecycle of backup data, see Manage the lifecycle of backup data.

  8. After the preceding configurations are complete, click Precheck in the lower-right corner of the page.

  9. In the Precheck dialog box, after the precheck is passed, click Start Task.

    Note
    • The configuration is complete when the schedule's Status changes to Running.

    • If the backup schedule fails or reports an error, you must troubleshoot and fix the issue promptly. For more information, see How to fix an abnormal DBS backup schedule. If the problem persists after you follow the suggestions, join the DBS customer support group on DingTalk (ID: 35585947) for assistance.

Restore data

  1. Log on to the Data Management Service (DMS) 5.0 console.

  2. In the top navigation bar, choose Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

  3. On the Backup Schedules page, find the backup schedule that you want to manage and click Manage in the Actions column.

  4. On the Configure Task page, click Restore Database in the upper-right corner.

  5. On the Configure recovery point page, configure the following parameters, and then click Next.

    Section

    Parameter

    Description

    N/A

    Restore task name

    DBS automatically generates a task name. You can specify a descriptive name to identify the task. The name does not need to be unique.

    Recovery point

    Recoverable time range

    The time range within which data can be restored.

    Selected recovery point

    Select the point in time to restore the data to. The time must fall within the recoverable time range.

    Restore destination

    Database location

    Select the location of the destination database. Valid values:

    • No public network IP: Port's self-built database (accessed through the database gateway): You must configure a database gateway for the database instance in advance and select the target DG instance ID in this step.

    • User-Created Database with Public IP Address <IP Address:Port Number>: You must configure the endpoint and port of the destination database instance.

    • ECS-Hosted Database: You must configure the ECS instance ID and the database port for the destination database instance.

    • ApsaraDB for MongoDB

    • Express Connect DB/VPN Gateway/Intelligent Gateway: You must configure a VPC for the database instance in advance and select the target Peer VPC in this step.

    Database type

    The value is the same as the database type you selected when you created the backup schedule.

    Note

    This parameter is not displayed if you set the Database location parameter to ApsaraDB for MongoDB.

    Region

    Select the region where the destination instance is located.

    Note

    This parameter is displayed only if you set the Database location parameter to ECS-hosted database, ApsaraDB for MongoDB, or Self-managed database without a public endpoint (accessed via Database Gateway).

    Endpoint

    The public endpoint of the target database.

    Note

    This parameter is displayed only if you set the Database location parameter to Self-managed database with a public endpoint, Self-managed database accessed via Express Connect, VPN Gateway, or Smart Access Gateway (SAG), or Self-managed database without a public endpoint (accessed via Database Gateway).

    Port

    The port used to connect to the target database.

    Note

    This parameter is not displayed if you set the Database location parameter to ApsaraDB for MongoDB.

    ECS instance ID

    Select the ID of the ECS instance to restore to.

    Note

    This parameter is displayed only if you set the Database location parameter to ECS-hosted database.

    MongoDB instance ID

    Select the ID of the MongoDB instance to restore to.

    Note

    This parameter is displayed only if you set the Database location parameter to ApsaraDB for MongoDB.

    Peer VPC

    Select the Virtual Private Cloud (VPC).

    Note

    This parameter is displayed only if you set the Database location parameter to Self-managed database accessed via Express Connect, VPN Gateway, or Smart Access Gateway (SAG).

    DG instance ID

    Select the Database Gateway (DG) instance.

    Note

    This parameter is displayed only if you set the Database location parameter to Self-managed database without a public endpoint (accessed via Database Gateway).

    Database name

    Enter the name of the database.

    Database account

    Enter the database account.

    Password

    Enter the password for the database account.

    Note

    After you enter the account credentials, you can click Test Connection to verify that the destination database information is correct. If the test fails, click Diagnose and adjust the destination database information as instructed.

    Compliance warranty regarding cross-border data transfers

    Read and agree to the compliance commitment by selecting the check box.

  6. On the Configure Objects to Restore page, configure the following parameters, and then click Precheck.

    Parameter

    Description

    Conflict handling

    By default, the Conflict Handling method is Rename on conflict. For example, if a table with the same name exists when you restore the job_info table, the system renames the new table to job_info_dbs_<Restoration Task ID>_<Timestamp>.

    Objects to restore

    In the Source database objects section, select the databases or collections to restore and move them to the Selected Objects box.

    Note

    Some databases support collection-level or database-level restoration, which reduces the amount of restored data and shortens the Recovery Time Objective (RTO). For more information, see Supported database types and features.

  7. In the Precheck dialog box, after the Precheck Passed message is displayed, click Start Task.

    You can view the database restore progress on the Restore Tasks tab.

    Note

    Restore time depends on the backup schedule specifications and database size. Higher specifications yield faster restore speeds. For more information, see Performance test results for logical and physical backups.

Related operations