tencent cloud

Feedback

Data Recovery

Last updated: 2024-01-15 14:40:06
    This document describes how to restore TencentDB for MongoDB data in the console.

    Overview

    When you need to restore multiple collections of the database, you can perform Collection Rollback in the console to restore the data to the current instance or a new instance. When you need to restore the data of the entire instance, you can directly clone a new instance based on the backup file of the current instance to restore the data.

    Version Description

    Version
    Rollback Method
    3.2, 3.6
    Rollback of entire instance (logical backup)
    Collection rollback (logical backup)
    4.0, 4.2
    Rollback of entire instance (logical backup, physical backup)
    Collection rollback (logical backup, physical backup)
    5.0
    Rollback of entire instance (logical backup, physical backup)
    Collection rollback (logical backup)

    Note

    The oplog space of an instance is a capped collection. When the collection space is used up, newly inserted elements will overwrite the initial header elements. If the oplog space is overwritten, backup and restoration may fail, and it will be impossible to guarantee the time point for data restoration. Therefore, set a reasonable oplog space size based on your business conditions.
    Pay close attention to the Oplog Time Difference metric in System Monitoring on the instance management page. The smaller the metric value, the greater the risk of oplog being overwritten when your business has frequent write, update, and deletion operations.

    Use Limits

    You can select up to 2,000 collections per instance to roll back.
    You can roll back data to any time point in the last 7 days.
    Note:
    If there are transaction operations on the client during the rollback process, you need to actively submit the transaction or set a timeout period to prevent the transaction from occupying lock resources for a long time and causing the rollback task to be abnormal.

    Prerequisites

    You have created a TencentDB for MongoDB instance. For more information, see Creating TencentDB for MongoDB Instance.
    The TencentDB for MongoDB replica set or sharded cluster instance is in Running status.
    You have backed up the data. For more information, see Data Backup.

    Directions

    Cloning an instance

    2. In the MongoDB drop-down list on the left sidebar, select Replica Set Instance or Sharded Cluster Instance. The directions for replica set instances and sharded cluster instances are similar.
    3. Above the Instance List on the right, select the region.
    4. In the instance list, find the target instance.
    5. Click the target instance ID to enter the Instance Details page.
    6. Select the Backup and Rollback > Backup Task List page.
    7. In the Backup Task List, find the backup file to be restored.
    8. Click Clone in the Operation column.
    9. On the Clone TencentDB for MongoDB Instance page, select configuration items such as billing mode and configuration specification of the new instance. For more information, see Creating TencentDB for MongoDB Instance.
    10. Confirm the fees and click Buy Now.
    11. Return to the instance list page. After the instance is created and the data of the source instance has been synced to the newly cloned instance, the new instance can be used.

    Rolling back a collection

    1. On the Instance Details page, select the Backup and Rollback tab.
    2. On the Backup and Rollback tab, select the Backup Task List.
    3. In the Backup Task List, find the backup file to be restored.
    4. Click Collection Rollback in the Operation column.
    
    5. In the Batch Collection Rollback wizard, click the Select Archive Instance tab, select Rollback to Current Instance or Rollback to New Instance after Roll Back Target Instance, select the rollback type, and select the instance to be rolled back. The details are as shown below:
    Note:
    The rollback target can be the current instance or a new instance.
    Rollback to Current Instance: The rollback type can only be Collection Rollback; that is, you can only select collections in the current instance for rollback.
    Rollback to New Instance: You need to purchase a new instance, which does not affect the source instance. You cannot select multiple instances for batch rollback. The rollback type can be Rollback of Entire Instance or Collection Rollback.
    Rollback of Entire Instance: Rolls back all the data of the current instance to a new instance.
    Collection Rollback: Batch rolls back the selected collections of the current instance to a new instance. As there is less data to be rolled back, rollback is faster at the database or collection level than at the instance level.

    Rollback to the current instance

    1. On the Select Archive Instance tab, Collection Rollback is selected for Rollback Type by default. Search for and select one or multiple source instances to be rolled back below.
    2. Click Next: Select databases/collections to roll back, select the databases or collections in the source instance to be rolled back on the Select Rollback Collection tab, and confirm the databases/collections information in the box area on the right.
    3. Click Next: Select a rollback date, select the time point to be rolled back on the Set Rollback Time tab, and confirm the information of the instance, databases, and collections.
    Note:
    Rolling back to the instance at that time will not directly roll back the original collection. Instead, a new backup file will be created. For example, if the source database collection is "test", a new database collection named "test_bak" will be created. After the rollback task is completed, the name of the databases and collections can be modified in batches as needed.
    4. Click Roll Back to return to the Rollback Task tab of Batch Collection Rollback, where you can see the rollback tasks being executed and wait for the task to complete. You can connect to the instance to confirm the correctness of the rollback data.
    5. (Optional) On the Batch Modify Collection Names tab of Batch Collection Rollback, find the rollback task that has been completed, and click Batch Modify Collection Names in its Operation column. Then, you can see the information of the collection to be modified in the right area, including the original collection name, the new collection name, the original rollback collection name, and the new rollback collection name.
    Click
    
    to download the collection information to be modified and view it locally.
    Confirm the modification and click Batch Modify Collection Names at the bottom left to complete the modification.
    Note:
    To batch modify collection names, you can only modify all database collections under a single instance under a single rollback task. If you initiate a batch rollback task and roll back database collections of multiple instances, you need to modify the collection names one by one.
    Batch modifying collection names includes modifying original collection names and rollback collection names.
    For the original collections, add the identifier " _ori" to their original names.
    For the rollback collections, change the names of the rollback collections to the original ones.

    Rollback to a new instance

    Rollback of entire instance
    1. On the Select Archive Instance tab, select Rollback to New Instance for Rollback Target Instance and Rollback of Entire Instance for Rollback Type. Then, select the source instance to be rolled back below. You can also search instances to be rolled back in the search box.
    Note:
    The rollback of the entire instance doesn't support selecting multiple instances for batch rollback, that is, only one instance can be selected for rollback.
    2. Click Purchase and Configure a Cloned Instance to enter the Clone TencentDB for MongoDB Instance page, and select configuration items such as billing mode and configuration specification of the new instance. For more information, see Creating TencentDB for MongoDB Instance.
    3. Confirm the fees, select Terms of Service, and click Buy Now.
    4. Return to the instance list page. After the instance is created and the data of the source instance has been synced to the newly cloned instance, you can connect to the new instance to confirm the correctness of the rollback data.
    Collection rollback
    1. On the Select Archive Instance tab, select Rollback to New Instance for Rollback Target Instance and Collection Rollback for Rollback Type. Then, select the source instance to be rolled back below. You can also search instances to be rolled back in the search box.
    Note:
    For the rollback operation, you can only select one instance for the database collection rollback, and can't perform batch rollback.
    2. Click Next: Select databases/collections to roll back, and select the databases or collections in the source instance to be rolled back on the Select Rollback Collection tab. In the search box, you can search for the databases/collections to be rolled back by their names. Then, you can view the selected databases/collections information in the right area The details are as shown below:
    In the area on the right, you can manage the selected databases/collections.
    Click Clear All to clear the selected databases/collections when you have made a wrong selection.
    Click
    
    to delete the selected databases/collections one by one.
    3. Click Next: Select a rollback date, select the time point to be rolled back on the Set Rollback Time tab, and confirm the information of the instance, databases, and collections.
    4. Click Purchase and Configure a Cloned Instance to enter the Clone TencentDB for MongoDB Instance page, and select configuration items such as billing mode and configuration specification of the new instance. For more information, see Creating TencentDB for MongoDB Instance.
    5. Confirm the fees and click Buy Now.
    6. Return to the instance list page. After the instance is created and the data of the source instance has been synced to the newly cloned instance, you can connect to the new instance to confirm the correctness of the rollback data.

    Batch rollback

    Note:
    Batch rollback refers to the process of rolling back databases/collections of multiple instances to the source instance at one time. The newly rollback databases/collections are suffixed with "_bak". After the rollback is completed, you can modify the database name as needed.
    2. In the MongoDB drop-down list on the left sidebar, select Batch Rollback.
    3. Click Roll Back to enter the Batch Collection Rollback configuration wizard.
    4. On the Select Archive Instance tab, select Rollback to Current Instance for Rollback Target Instance and Collection Rollback for Rollback Type. Then, select the source instance to be rolled back below. You can also search instances to be rolled back in the search box.
    5. Click Next: Select databases/collections to roll back, and select the databases or collections in the source instance to be rolled back on the Select Rollback Collection tab. You can search for databases or collections by their names in the drop-down list of each instance. Then, you can view the selected databases/collections information in the right area
    6. Click Next: Select a rollback date, select the time point to be rolled back on the Set Rollback Time tab, and confirm the information of the instance, databases, and collections.
    7. Click Roll Back to return to the Rollback Task tab of Batch Collection Rollback, where you can see the rollback tasks being executed and wait for the task to complete. You can connect to the instance to confirm the correctness of the rollback data.
    8. (Optional) Return to the Batch Modify Collection Names tab of Batch Collection Rollback, find the rollback task that has been completed, and click Batch Modify Collection Names in its Operation column. Then, you can see the information of the collection to be modified in the right area, including the original collection name, the new collection name, the original rollback collection name, and the new rollback collection name. Confirm the modification and click Batch Modify Collection Names at the bottom left to complete the modification.
    Note:
    The batch rollback operation rolls back databases/collections of multiple instances at a time. When modifying the collection names, you need to modify the collection name of each instance one by one.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support