After the data flashback feature is enabled, you can restore the data of an instance or a specific key to a point in time that is accurate to the second from an unexpired backup file. This process is called point-in-time recovery (PITR). You can restore data to a new instance or the original instance. Such a refined data restoration capability can protect business data and prevent data loss that is caused by accidental operations to the greatest extent.
Data flashback overview
To protect your business data in the cloud, Tair 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 to allow AOFs to be incrementally archived. This way, data can be restored to a point in time accurate to the second. This facilitates O&M and allows you to use Tair for persistent storage.
After the data flashback feature is enabled for an instance, you can restore the data of the instance or a specific key to a point in time that is accurate to the second from an unexpired backup file. The maximum retention period of backup files is seven days. You can restore data to a new instance or the original instance. Such a refined data restoration capability can prevent data loss caused by accidental operations to the greatest extent.
If you restore data to the original instance, the key that you want to restore is written back to the instance, which may increase the queries per second (QPS) or latency of the instance. We recommend that you restore data during off-peak hours.
Prerequisites
Cloud-native deployment mode: An DRAM-based or persistent memory-optimized instance is created.
Classic deployment mode: An DRAM-based instance that uses the standard or cluster architecture is created.
To view the architecture of an instance, you can log on to the console and check the Instance Class 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, data 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, only full data can be restored. You cannot restore specific keys.
Billing
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 charged based on points in time of restoration. For more information, see this topic or the announcement on the Alibaba Cloud website.
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
Log on to the Tair 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.
In the left-side navigation pane, click Backup and Restoration.
On the Backup and Restoration page, click the Data Flashback tab.
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 expected point in time when the upload is complete.
ImportantYou can restore only data that is written to the instance after data flashback is enabled.
Perform data flashback
Log on to the Tair 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.
In the left-side navigation pane, click Backup and Restoration.
On the Backup and Restoration page, click the Data Flashback tab.
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
matcheshllo
orheeeello
.Question mark (?): matches zero or one occurrence of a preceding subexpression. For example,
h.?llo
matcheshllo
orhello
.Character set [Characters]: matches a character included in brackets [ ]. For example,
h[ae]llo
matcheshallo
orhello
.Negative character set [^Characters]: does not match a character in brackets [ ]. For example,
h[^ae]llo
matcheshcllo
orhdllo
, but nothallo
orhello
.Character range [Character1-Character2]: matches characters in the range of
Character1 to Character2
. For example,h[a-b]llo
matcheshallo
andhbllo
.
NoteTo ensure the efficiency of data restoration, we recommend that you specify no more than 10 keys or specify no more than three keys that use regular expressions.
Recovery mode
New instance: restores data to a new instance.
The original instance: restores data to the current instance.
WarningYou can restore data to the original instance only if you set Flashback data to Specify Key.
The specified keys are deleted. Tair restores the specified keys to the specified point in time from the backup file. This has no impact on other keys in the instance.
Flashback Time Point
The point in time to which you want to restore data.
Handle Expired Keys
Default: No operations are performed on the time-to-live (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 expiration offset time point.
For example, assume that you restore the
foo
key at 10:30 on December 12, 2022 and set Flashback Time Point to December 12, 2022, 10:00:00, and the TTL of thefoo
key at the specified flashback time point is 10 seconds. In this case, if you set Offset Time to December 12, 2022, 10:30:00, thefoo
key expires at 10:30:10 on December 12, 2022.NoteOnly classic instances support this feature.
The expiration offset time point must be between the specified flashback time point and the time point when the data restoration task is submitted.
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.
NoteThe new instance must be of 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 Create a Tair instance.
Related API operations
API operation | Description |
Modifies the automatic backup policy of an instance of Tair. 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 instances. | |
Restores the data of an instance of Tair 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. |