All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Use data flashback to restore data by point in time

Last Updated:Feb 24, 2025

After the data flashback feature is enabled for an instance, you can restore the entire instance or specific keys of the instance to a point in time accurate to the second within the backup retention period. The backup retention period is up to seven days. This process is called point-in-time recovery (PITR). You can restore data to a new instance or the original instance. Data flashback enables easier and more granular data restoration, which can minimize data loss caused by accidental operations and secure your data. You can use Tair (Enterprise Edition) for persistent storage.

Data flashback overview

To protect your business data in the cloud, Tair (Enterprise Edition) provides the data flashback feature in addition to the data backup and restoration features based on Redis Database (RDB) snapshots. The data flashback feature optimizes append-only file (AOF) persistence by allowing AOFs to be incrementally archived. This facilitates instance O&M.

If you enable the data flashback feature, Tair (Enterprise Edition) creates a full backup and records the timestamp of each write operation. As the instance continuously triggers AOF rewrite operations, Tair (Enterprise Edition) continuously backs up each AOF.

When performing data flashback, Tair (Enterprise Edition) retrieves the most recent full backup closest to the specified point in time. It then replays the consecutive AOF records up to the exact second to which you want to restore data.

image
  • If you choose to restore full data, you can restore data only to a new instance.

  • If you choose to restore specific keys, you can restore the keys to the original instance. However, only classic instances support this feature. The specified keys are deleted. Tair (Enterprise Edition) restores the specified keys to the specified point in time from the backup file. This has no impact on other keys in the instance.

Prerequisites

  • Cloud-native deployment mode: A Tair (Enterprise Edition) DRAM-based or persistent memory-optimized instance is created.

  • Classic deployment mode: A Tair (Enterprise Edition) DRAM-based instance that uses the standard or cluster architecture is created.

Note

To view the architecture of an instance, you can log on to the console and check the Instance Type parameter.

Limits

  • After you enable the data flashback feature, the system needs to upload related data and logs. Do not use the feature immediately after you enable it. If you want to use this feature, make sure that you enable it in advance to allow for the necessary data and log uploads.

  • You can restore data only to a specific point in time that is in the time range from when data flashback 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 change or the feature may be disabled due to the following operations:

    • If you change the architecture of an instance, for example, from standard to cluster, or if you migrate the instance to another zone, date flashback is disabled for the instance. To use data flashback, you must re-enable the feature.

    • If you add a data shard to or remove a data shard from a cluster instance, inconsistency in backup data may occur. In this case, you must re-enable the feature.

    • If you change the configurations or update the minor version of an instance, you can restore data only to a time point later than the time point when the change is complete.

  • For cloud-native instances, you can restore the entire dataset to a new instance, but cannot restore specific keys.

  • If the write rate of an instance exceeds 20 MB/s, AOFs may not be archived in time or fail to be archived. If AOFs fail to be archived, data flashback cannot be performed during the period of time when the AOFs fail to be archived up to when the next full backup is completed.

  • By default, an instance backs up data on a replica node. However, if data flashback is enabled for the instance, data is backed up on the master node of the instance.

Billing

During the trial period of the data flashback feature, you can restore data to a point in time within the previous seven days free of charge. After the official release, this feature is charged based on the points in time used for 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 instance. You must pay for the new instance. You can set the billing method of the new instance to pay-as-you-go and release the instance after it is no longer needed. For more information, see Billable items.

Enable the data flashback feature

  1. Log on to the console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the left-side navigation pane, click Backup and Restoration.

  3. On the Backup and Restoration page, click the Data Flashback tab.

  4. Click Enable Now.

    After you enable the data flashback feature, it takes a specific amount of time for the system to upload data and logs before you can use the feature. The console displays an estimated upload completion time.

    Important

    You can restore only data that is written to the instance after data flashback is enabled.

Perform data flashback

  1. Log on to the console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the left-side navigation pane, click Backup and Restoration.

  3. On the Backup and Restoration page, click the Data Flashback tab.

  4. Click Start Flashbacking. In the dialog box that appears, configure the parameters described in the following table.

    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:

      • Period (.): matches a single character except '\r\n'.

      • Asterisk (*): matches zero or more occurrences of a preceding subexpression. For example, h.*llo matches hllo or heeeello.

      • Question mark (?): matches zero or one occurrence of a preceding subexpression. For example, h.?llo matches hllo or hello.

      • Character set [Characters]: matches a character included in brackets [ ]. For example, h[ae]llo matches hallo or hello.

      • Negative character set [^Characters]: does not match a character in brackets [ ]. For example, h[^ae]llo matches hcllo or hdllo, but not hallo or hello.

      • Character range [Character1-Character2]: matches a character in the range of 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.

    Flashback Time Point

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

    Handle Expired Keys

    When you restore a classic instance, regardless of whether you restore full data or specific keys, you can apply an offset to the time-to-live (TTL) of the keys.

    • Default: No operations are performed on the TTL of keys. If a key has already expired before the data restoration task is initiated, the key cannot be restored.

    • Time Offset: The TTL of a key at the flashback time point remains in effect at the restore time point. You must also specify the Offset Time parameter. The TTL of the key at the specified flashback time point starts counting down at the offset time point.

      For example, when you perform data flashback to restore a key, you set Flashback Time Point to December 12, 2022 10:00:00, and Offset Time to December 12, 2022 10:30:00. If the TTL of the key is 10s at 10:00:00 on December 12, 2022, the key will expire at 10:30:10 on December 12, 2022.

      Note

      This feature only allows you to offset the TTL of keys. It does not allow you to offset the TTL of keys in self-developed data structures of Tair, such as fields in exHash and skeys in TairTS.

      The offset time point must be between the specified flashback time point and the time when the data restoration task is submitted.

  5. Click OK.

    • If you set the Recovery mode parameter to The original instance, the current instance enters the Restoring state. Wait until the instance state changes to Running.

    • If you set the Recovery mode parameter to New instance, the Clone Instance page appears. You must specify the point in time to which you want to restore data and the configurations of the new instance on this 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 instance parameters, see Step 1: Create an instance.

Related API operations

API operation

Description

ModifyBackupPolicy

Modifies the automatic backup policy of an instance. You can use the EnableBackupLog parameter to enable or disable the data flashback feature.

To use the data flashback feature, you must set the appendonly parameter to yes to enable AOF persistence. For more information, see Parameters that can be configured for Tair (Enterprise Edition) instances.

RestoreInstance

Restores the data of an instance from a backup file to the instance. If you use this operation together with the data flashback feature, you can restore data of a specific key to a specific point in time that is accurate to the second.