All Products
Search
Document Center

ApsaraDB for MongoDB:Restore backup data to a new instance by point in time

Last Updated:Nov 01, 2024

ApsaraDB for MongoDB allows you to create an instance at a point in time when the original instance is running, and restore the backup data at that point in time to the new instance. This method is suitable for data restoration and verification.

Instance architecture

  • Replica set instances

  • Sharded cluster instances

Usage notes

  • To ensure data accuracy in point-in-time restoration, you can turn on Log Backup. If you turn off Log Backup, ApsaraDB for MongoDB selects the latest full backup for restoration due to missing oplog entries. This results in data inaccuracy. For more information about how to enable the binary logging feature, see Configure automatic backup for an ApsaraDB for MongoDB instance.

    Note

    If the point in time that you specify is not a valid time point for log backups, point-in-time backup data also cannot be restored to a new instance.

  • Individual databases can be restored only from physical backups and not from logical backups. If your instance runs a MongoDB version earlier than 4.0 and the total number of collections and indexes in your instance exceeds 10,000, physical backups may fail. Before you implement a physical backup, upgrade the database version of your instance to MongoDB 4.0 or later. For more information about how to upgrade the database version, see Upgrade the major version of an ApsaraDB for MongoDB instance.

    Important

    After the database version is upgraded, the backup files of the original instance that runs a MongoDB version earlier than MongoDB 4.0 cannot be used to restore data to the new instance.

  • The amount of time required varies based on factors such as the data volume, task queue length, and network conditions. When the state of the new instance changes to Running, the restoration is complete.

  • If the minor version of an instance expires or is not maintained, ApsaraDB for MongoDB automatically updates the minor version of the instance to the latest version when you restore backup data from the original to the new instance by point in time. This ensures the performance and stability of the instance.

Billing

In this method, an instance is created at a point in time when the original instance is running, and you are charged for the new instance. For more information, see Billable items.

Replica set instance

  1. Go to the Replica Set Instances page. In the top navigation bar, select the region in which the 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, click Create Instance by Time Point.

  4. In the Create Instance by Time Point panel, configure the parameters described in the following table and then click OK.

    Parameter

    Description

    Select Time Point for Restoration

    The point in time from which you want to restore data.

    Note
    • The point in time that you select must be earlier than the current time and later than the time when the original instance was created.

    • The restoration time range is the retention period of log backup files. For more information about how to set the retention period of log backup files, see Configure automatic backup for an ApsaraDB for MongoDB instance.

    Select Database for Restoration

    • All Databases: All databases in the source instance are restored.

    • Partial Databases: Only selected databases are restored.

      You can select the databases that you want to restore or click Enter Databases to enter the names of the databases.

      Note
      • If you enter the names of the databases, separate the names with commas (,).

      • If the MongoDB version has been upgraded, the backup files of the original instance that runs an earlier version cannot be used to restore data to the new instance.

      • You can select All Databases only for replica set instances that use cloud disks.

  5. Create an instance.

    1. On the Clone Instance page, set Product Type.

      • Replica Set (Subscription): If you purchase a subscription instance, you must pay an upfront fee. If you want to use an instance for a long period of time, the subscription billing method is more cost-effective than the pay-as-you-go billing method. You are offered lower prices for longer subscription periods.

      • Replica Set (Pay-as-you-go): The system generates a bill and deducts the fee from your Alibaba Cloud account per hour. The amount is calculated based on the instance type and largest storage capacity of your instance at the time of billing. We recommend that you select the pay-as-you-go billing method for short-term usage. If you no longer require a pay-as-you-go instance, you can release it to reduce costs.

    2. Configure the new instance. For more information, see Create a replica set instance.

      Important

      The storage capacity of the new instance must be greater than or equal to that of the source instance.

  6. Confirm the order and complete the payment.

    1. Click Buy Now.

    2. On the Confirm Order page, read and select Terms of Service.

    3. Click Pay.

    4. Complement the payment.

Sharded cluster instance

  1. Go to the Sharded Cluster Instances page. In the top navigation bar, select the region in which the 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. (Optional) In the upper-right corner of the page that appears, click Upgrade to Cluster Backup Mode.

    Note

    This step is required only for sharded cluster instances that use cloud disks and were created before October 18, 2023. If this button is not displayed in the upper-right corner, the database version of the instance has been upgraded.

  4. On the Full Backup tab, click Create Instance by Time Point.

  5. In the Create Instance by Time Point panel, configure the parameters described in the following table and then click OK.

    The page information of a sharded cluster instance that uses cloud disks differs from that of a sharded cluster instance that uses local disks. Select operations based on the instance category.

    Instances that use cloud disks

    Parameter

    Description

    Restoration Mode

    Select Create Instance By Time Point.

    Note

    For more information about database/collection restoration, see Restore the databases of an instance.

    Valid Time Range

    The period of time during which the data of the source instance is restored to the new instance. You do not need to configure this parameter.

    Select Time Point for Restoration

    The point in time from which you want to restore data.

    Note
    • The point in time that you select must be earlier than the current time and later than the time when the original instance was created.

    • The restoration time range is the retention period of log backup files. For more information about how to set the retention period of log backup files, see Configure automatic backup for an ApsaraDB for MongoDB instance.

    Select Database for Restoration

    By default, this parameter is set to All Databases.

    Note

    If the MongoDB version has been upgraded, the backup files of the original instance that runs an earlier version cannot be used to restore data to the new instance.

    Instances that use local disks

    Parameter

    Description

    Select Time Point for Restoration

    The point in time from which you want to restore data.

    Note
    • The point in time that you select must be earlier than the current time and later than the time when the original instance was created.

    • The restoration time range is the retention period of log backup files. For more information about how to set the retention period of log backup files, see Configure automatic backup for an ApsaraDB for MongoDB instance.

    Select Database for Restoration

    Select All Databases.

    Note
    • If the MongoDB version has been upgraded, the backup files of the original instance that runs an earlier version cannot be used to restore data to the new instance.

    • By default, you can restore only all databases in a sharded cluster instance that uses local disks. You do not need to configure this parameter.

    Important
    • The point in time that you select must be earlier than the current time and later than the time when the original instance was created.

    • To ensure that data is complete and accurate, do not select the most recent point in time (usually within the last hour) if the instance is a sharded cluster instance. Otherwise, the restoration fails.

    • The restoration time range is the retention period of log backup files. For more information about how to set the retention period of log backup files, see Configure automatic backup for an ApsaraDB for MongoDB instance.

  6. Create an instance.

    1. On the Clone Instance page, set Product Type.

      • Sharded Cluster (Subscription): If you purchase a subscription instance, you must pay an upfront fee. If you want to use an instance for a long period of time, the subscription billing method is more cost-effective than the pay-as-you-go billing method. You are offered lower prices for longer subscription periods.

      • Sharded Cluster (Subscription): The system generates a bill and deducts the fee from your Alibaba Cloud account per hour. The amount is calculated based on the instance type and largest storage capacity of your instance at the time of billing. We recommend that you select the pay-as-you-go billing method for short-term usage. If you no longer require a pay-as-you-go instance, you can release it to reduce costs.

    2. Configure the new instance. For more information, see Create a sharded cluster instance.

      Important
      • The number of shard nodes in the new instance must be equal to that in the original instance.

      • The storage capacity of each shard node in the new instance must be greater than or equal to that in the original instance.

  7. Confirm the order and complete the payment.

    1. Click Buy Now.

    2. On the Confirm Order page, read and select Terms of Service.

    3. Click Pay.

    4. Complement the payment.

FAQ

Why am I unable to find the Create Instance By Time Point tab in the ApsaraDB for MongoDB console?

The tab is displayed only for replica set and sharded cluster instances but not for standalone instances in the ApsaraDB for MongoDB console.