After you enable the data flashback feature for your ApsaraDB for Redis instance, you can restore data during the retention period of backup files. During the retention period, you can restore the data of the whole instance or a specified key to a point in time that is accurate to the second. You can restore data to a new instance or the current instance. This much more fine-grained data restoration prevents data loss that is caused by accidental operations to the maximum extent and protects your business data.

Prerequisites

Overview

In addition to using RDB snapshots to backup and restore data, ApsaraDB for Redis Enhanced Edition (Tair) provides the data flashback feature to protect your business data in the cloud. This feature optimizes append-only file (AOF) persistence and archives incremental AOF files. This allows you to restore data in a few seconds in a convenient way and facilitates O&M. This way, you can use ApsaraDB for Redis Enhanced Edition (Tair) as a persistent storage engine.

After you enable the data flashback feature for your ApsaraDB for Redis instance, you can restore data during the retention period of backup files. The maximum retention period is seven days. During the retention period, you can restore the data of the whole instance or a specified key to a point in time that is accurate to the second. You can restore data to a new instance or the current instance. This much more fine-grained data restoration prevents data loss that is caused by accidental operations to the maximum extent.

Note If you restore data to the current instance, the queries per second (QPS) and latency may increase because the data of the specified key is written to the instance. To prevent the impact on the performance of the instance, restore data during off-peak hours.
Figure 1. Two modes of the data flashback feature
Two modes of the data flashback feature

Limits

  • You can restore data only to a specific point in time during the period from the time when the data flashback feature is enabled to the current time. This period can be up to seven days.
  • After the data flashback feature is enabled, the point in time for data backup may be changed due to configuration changes, migration across zones, or minor version updates. For example, if you change the configurations of an instance, the point in time to which you can restore data starts from the time when the configuration change is complete.
  • After you enable the data flashback feature, the system requires about 10 minutes to upload data and logs. Do not use this feature immediately after you enable it.

Pricing

During the trial period of the data flashback feature, you can restore data to a point in time within the last seven days free of charge. After the official release, this feature is billed based on the point in time of restoration. For more information, see this topic or the announcement on the Alibaba Cloud website.

Note If you use the data flashback feature to restore data to a new instance, the system creates an instance and restores data to the new instance. You can select pay-as-you-go as the billing method and release the new instance after data verification. You must pay for the new instance. For more information, see Billable items and prices.

Enable the data flashback feature

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar of the page, select the region where the instance is deployed.
  3. On the Instances page, click the ID of the instance.
  4. In the left-side navigation pane, click Backup and Recovery.
  5. On the Backup and Recovery page, click the Data Flashback tab.
  6. Click Enable Now.
    Note If the appendonly parameter is set to no, AOF persistence is disabled. In the dialog box that appears, you are prompted to enable the AOF persistence feature. For more information about how to enable AOF persistence, see Parameter overview.

Perform data flashback

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar of the page, select the region where the instance is deployed.
  3. On the Instances page, click the ID of the instance.
  4. In the left-side navigation pane, click Backup and Recovery.
  5. On the Backup and Recovery page, click the Data Flashback tab.
  6. Click Start Flashbacking. In the dialog box that appears, set the parameters for data flashback.
    Figure 2. Perform data flashback
    Perform data flashback
    Parameter Description
    Flashback data
    • Full data: All data on the instance is restored.
    • Specify Key: Specify one or more keys whose data you want to restore. Each key name occupies a line. You can specify regular expressions based on the following rules:
      • A period (.) matches a single character excluding '\r\n'.
      • An asterisk (*) matches zero or more occurrences of a subexpression that occurs before. For example, h.*llo matches hllo and heeeello.
      • A question mark (?) matches zero or one occurrence of a subexpression that occurs before. For example, h.?llo matches hllo and hello.
      • The [characters] character set matches a character included in the brackets []. For example, h[ae]llo matches hallo and hello.
      • The [^characters] negative character set does not match a character included in the brackets []. For example, h[^ae]llo matches hcllo and hdllo, but not hallo or hello.
      • The [character1-character2] character range matches a character included in the range from character1 to character2. For example, h[a-b]llo matches hallo and hbllo.
      Note To ensure the efficiency of data restoration, we recommend that you specify no more than 10 keys or specify no more than three regular expressions.
    Recovery mode
    • New instance: restores data to a new instance.
    • The original instance: restores data to the current instance. If you set the Flashback data parameter to Specify Key, only the data of the specified keys can be restored to the specified point in time and other keys are not affected.
    Flashback Time Point The point in time to which you want to restore data.
    Note If you set the Recovery mode parameter to The original instance, you must set this parameter. If you set the Recovery mode parameter to New instance, you must specify the point in time for restoration on the Clone Instance page.
  7. Click OK.
    • If you set the Recovery mode parameter to The original instance, the current instance enters the Restoring state. Wait until the instance status changes to Running.
    • If you set the Recovery mode parameter to New instance, you must specify the point in time to which you want to restore data and the configurations of the new instance on the Clone Instance page.
      Note The new instance must use the standard or cluster architecture, and the capacity of the new instance must be greater than or equal to that of the original instance. For more information about the parameters for the new instance, see Create an ApsaraDB for Redis Community Edition instance or a performance-enhanced instance of ApsaraDB for Redis Enhanced Edition (Tair).

Related operations

Operation Description
RestoreInstance Restores the data of an ApsaraDB for Redis instance from a backup file to the instance. If you use the operation together with the data flashback feature, you can restore data of a specified key to a specified point in time that is accurate to the second.