This topic describes how to restore MongoDB databases.

Prerequisites

The databases are backed up. For more information, see Use DBS to back up MongoDB databases and Back up an ApsaraDB for MongoDB instance from a secondary instance.

Restore a MongoDB database

  1. Log on to the DBS console.
  2. In the left-side navigation pane, click Backup Schedules. On the Backup Schedules page, select a region in the upper-left corner.
    Select a region
  3. On the Backup Schedules page, click Manage in the Actions column corresponding to the ID of the backup schedule based on which you want to create physical backups.
  4. On the Configure Task page, click Restore Database in the upper-right corner.
  5. In the Set Time Restored To step of the Create Restore Task wizard, set the parameters as described in the following table and click Next.
    Section Parameter Description
    None Task Name The name of the restoration task. DBS generates a task name. We recommend that you set a descriptive task name that is easy to identify. Task names do not have to be unique.
    Set Time Restored To Time Range Available to Restore The time range available to restore the source database. DBS displays the available time range.
    Restore To The point in time to which you want to restore the source database. The value must be within the time range specified by the Time Range Available to Restore parameter.
    Configure Destination Database Database Location The location of the database that you want to back up. Valid values:
    • User-Created Database with Public IP Address
    • ECS-Hosted Database
    • Express Connect DB/VPN Gateway/Intelligent Gateway
    • ApsaraDB for MongoDB
    • No public network IP: Port's self-built database (accessed through the database gateway)
    Database Type The type of the database that you want to restore. By default, the type that is selected when you create the backup schedule is used.

    If Database Location is set to ApsaraDB for MongoDB, this parameter is not displayed.

    Instance Region The region where the database that you want to back up resides.

    This parameter is available only when you set Database Location to ECS-Hosted Database, ApsaraDB for MongoDB, or No public network IP: Port's self-built database (accessed through the database gateway).

    Address The public endpoint used to connect to the database that you want to restore.

    This parameter is available only when you set Database Location to User-Created Database with Public IP Address, Express Connect DB/VPN Gateway/Intelligent Gateway, or No public network IP: Port's self-built database (accessed through the database gateway).

    Port Number The port used to connect to the database that you want to restore.

    If you set Database Location to ApsaraDB for MongoDB, this parameter is unavailable.

    ECS Instance ID The ID of the Elastic Compute Service (ECS) instance where the database that you want to back up resides.

    This parameter is available only when you set Database Location to ECS-Hosted Database.

    MongoDB Instance ID The ID of the MongoDB instance that you want to back up.

    This parameter is available only when you set Database Location to ApsaraDB for MongoDB.

    Peer VPC The virtual private cloud (VPC) where the database that you want to restore resides.

    This parameter is available only when you set Database Location to Express Connect DB/VPN Gateway/Intelligent Gateway.

    Database gateway instance ID The ID of the database gateway instance.

    This parameter is available only when you set Database Location to No public network IP: Port's self-built database (accessed through the database gateway).

    Database Name The name of the database that you want to restore.
    Database Account The username of the account used to connect to the database that you want to restore.
    Password The password of the account used to connect to the database that you want to restore.

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

  6. In the Configure Objects to Restore step, set the parameters as described in the following table and click Precheck.
    Parameter Description
    Conflict Handling Select one of the following methods for Conflict Handling:
    • Fail when Object with the Same Name Exists.
    • Rename Object with the Same Name: If you select this option, DBS renames the new table that is to be created by the restoration task. For example, a table to be restored in the source database and an existing table in the destination database have the same name job_info. The system renames the new table that is restored from the table in the source database in the following format: job_info_dbs_<ID of the restoration task>_</Timestamp>.
    Objects to Restore The database or table that you want to restore. Select the database or table that you want to restore in the Available section and click the right arrow to add it to the Selected section.
  7. If the Precheck Passed message appears, click Start Task.