PolarDB-X allows you to restore historical data from backups. This topic describes how to restore data.

Method

PolarDB-X allows you to restore data by point in time. This method depends on data backup and log backup. You can restore data to a specific point in time within the backup time range. The time can be accurate to seconds. For example, if a data backup set of an instance was created at 00:00:01 on January 1, 2021 and log backup is enabled, you can restore data to any second since 00:00:01 on January 1, 2021.

Global consistency

PolarDB-X is a distributed database service. In PolarDB-X, data is stored on multiple data nodes. If distributed transactions exist in an instance, the instance to which data is restored must ensure that data is consistent among data nodes.

In the preceding figure, a table that records account balances is stored in PolarDB-X. The data in the table is distributed to two data nodes. The sum of the account balances is CNY 200. In this example, distributed transactions are used to transfer money between different accounts.

At 16:14:20 on July 25, 2021, Account C transferred CNY 30 to Account A, and Account D transferred CNY 20 to Account C. If you want to restore data to 16:14:20 on July 25, 2021 and ensure global consistency, you can restore data only to the specific point in time before or after the transactions are processed. In this case, the sum of account balances must equal CNY 200, as shown in Restoration 2 in the preceding figure. In this scenario, data cannot be restored based on Restoration 1 that is shown in the preceding figure. If data is restored based on Restoration 1, the sum of account balances during data restoration equals CNY 250. This causes global inconsistency.

Restore data to a new instance

PolarDB-X can restore data only to a new instance. After data is restored, we recommend that you use data transmission tools such as Data Transmission Service (DTS) to migrate data back to the original instance.
  • The new instance to which the data is restored and the original instance must contain the same IP addresses and CIDR blocks in their whitelists, and use the same backup and parameter configurations.
  • The data in the new instance is the same as the data in the backup file or the data at the specified point in time.
  • The information about the account that is used to create the data backup or log backup is replicated to the new instance.
  • The new instance and the original instance use the same topology. This means that the number of nodes in the new instance is the same as the number of nodes in the original instance.

Pricing and billing method

Data is restored to a new instance. You are charged for using the new instance.

Precautions

If you want to restore data to a specific point in time, make sure that the log backup feature is enabled. When you configure a data backup policy, the retention period for log backups must be more than 0.

Restore data to a specific point in time

  1. Log on to the PolarDB-X console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. On the Instances page, click the PolarDB-X 2.0 tab.
  4. Find the target instance and click its ID.
  5. Click Recovery.
  6. On the page that appears, configure the following parameters.
    Parameter Description
    Instance to Be Restored The ID of the instance that you want to restore.
    Restoration Type This parameter is set to Clone. You do not need to specify this parameter.
    Restoration Time The point in time to which you want to restore data.
    Note The earliest point in time to which you can restore data is the time when the first backup set is created.
    Region and Zone By default, the values of the two parameters are the same as those of the original instance. You do not need to specify the two parameters.
    Network Type The network type can only be VPC. You cannot change the network type.
    VPC Make sure that the PolarDB-X cluster is created in the same VPC as the ECS instance to which you want to connect. Otherwise, the cluster and the ECS instance cannot communicate over the internal network to achieve optimal performance.
    Note Before you configure a VPC, make sure that a VPC and a vSwitch are available in the selected region and the selected zone. For more information, see Create and manage a VPC.
    vSwitch The vSwitch of the instance to which the data is restored.
    Compatibility By default, this parameter is set to the MySQL version of the original instance. You do not need to specify this parameter.
    Node Specifications You are charged for PolarDB-X based on the node specifications and the number of nodes. You can configure this parameter to specify the number of CPU cores and memory size for the instance. For more information, see Instance types.
    Nodes By default, the number of nodes in the instance to which the data is restored is the same as the number of nodes in the original instance. You cannot change this value.
    Storage Type By default, the storage type of the instance to which the data is restored is the same as the storage type of the original instance. You do not need to specify this parameter.
    Storage Cost By default, each node provides 3 TB of storage. You do not need to specify the storage capacity for each node when you create a PolarDB-X instance. If you select the pay-as-you-go billing method for your PolarDB-X instance, you can be charged for storage fees per hour.
    Duration Select the subscription duration of the instance.
    Note This parameter is available only when the Product Type parameter of the original instance is set to Subscription.
    Quantity By default, this parameter is set to 1. You cannot change this value.
  7. Select PolarDB-X 2.0 (Subscription) Terms of Service and click Buy Now.
  8. On the Purchase page, confirm the unpaid order and the payment method, and click Purchase.
  9. After you complete the payment, the specified number of instances requires approximately 10 to 15 minutes to be created. After the instances are created, you can return to the Instance List page of the PolarDB-X console to view the newly created instances.