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.

Prerequisites

  • The instance is a replica set or sharded cluster instance.
    Important Standalone instances do not support point-in-time data restoration to a new instance.
  • Only points in time within the last seven days can be selected for data restoration.

Precautions

  • To ensure the data accuracy in point-in-time restoration, we recommend that you turn on Log Backup. For more information, see Configure automatic backup for an instance.
    Note
    • If you turn off the log backup switch, point-in-time backup data cannot be restored to a new instance because oplogs are missing.
    • 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 MongoDB version of your instance to 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.
    Note After the database version is upgraded, the backup files of the original instance that runs a MongoDB version earlier than 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 included in the maintenance list, ApsaraDB for MongoDB automatically updates the minor version of the instance to the latest version when you perform the following operations. 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 and pricing.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.
  3. In the upper-left corner of the page, select the resource group and region to which the instance belongs.
  4. Click the ID of an instance, or click More icon in the Actions column corresponding to the instance and select Manage.
  5. In the left-side navigation pane of the instance details page, click Backup and Recovery.
  6. Click the Full Backup tab.
  7. Select the databases that you want to restore.
    Note To ensure the data accuracy in point-in-time restoration, we recommend that you turn on Log Backup. If you turn off Log Backup, ApsaraDB for MongoDB selects the latest full backup for restoration. This results in data inaccuracy. For more information about how to turn on the log backup switch, see Configure automatic backup for an instance.
    1. Click Create Instance By Time Point.
    2. In the Create Instance By Time Point panel, specify the following parameters.
      Parameter Description
      Select recovery time point The point in time from which you want to restore data. Points in time within the last seven days can be selected.
      Note The point in time you select must be earlier than the current time and later than the time when the original instance was created.
      Select databases to recover
      • All Databases: restores the data of all databases from the original instance to the new instance.
      • Select Databases: restores the data of specific databases from the original instance to the new instance.
        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.
        • By default, all databases are restored for sharded cluster instances. You can skip this step if the instance is a sharded cluster instance.
        • 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.
        • You can select only All Databases for replica set instances that run MongoDB 5.0 or 4.4.
    3. Click OK.
  8. Create an instance.
    1. On the Clone Instance page, set Product Type.
      • Replica Set (Subscription) or Sharded Cluster (Subscription): If you purchase a subscription instance, you must pay an upfront fee. The subscription billing method is more cost-effective than the pay-as-you-go billing method for long-term use.
      • Replica Set (Pay-as-you-go) or Sharded Cluster (Pay-as-you-go): A pay-as-you-go instance is charged on an hourly basis as per its configurations. Fees are automatically deducted from your Alibaba Cloud account. For short-term use, we recommend that you select the pay-as-you-go billing method. If you no longer need a pay-as-you-go instance, you can release the instance to reduce costs.
    2. Configure the new instance. For more information, see Create a replica set instance or Create a sharded cluster instance.
      Note
      • Replica set instance: The storage capacity of the new instance must be greater than or equal to that of the original instance.
      • Sharded cluster instance:
        • 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.
  9. Confirm the order and complete the payment.
    1. Read and select the ApsaraDB for MongoDB Terms of Service and click Buy Now.
    2. On the Purchase page, click Pay.
    3. Pay for the order.