Point-in-time recovery (PITR) restores an entire instance or specific keys to a precise second within a seven-day backup retention window. Data can be restored to a new or the original instance, minimizing data loss from operational errors. Tair (Enterprise Edition) instances can also serve as persistent storage engines.
Point-in-time recovery
In addition to RDB snapshot backup, Tair (Enterprise Edition) offers point-in-time recovery. This feature incrementally archives Append-only File (AOF) files for granular data restoration.
When PITR is enabled, Tair (Enterprise Edition) creates a full backup and timestamps every write operation. As AOF rewrites occur, Tair (Enterprise Edition) continuously backs up each AOF file.
During recovery, Tair (Enterprise Edition) retrieves the full backup closest to the target time and replays AOF files up to the exact second specified.
-
Full data restoration is available only to a new instance.
-
Specific-key restoration supports restoring to the original instance (classic instances only). The system deletes the specified keys and restores them from the backup to the target time. Other keys are not affected.
Prerequisites
-
The instance uses the cloud-native deployment mode and is a Tair (Enterprise Edition) DRAM-based, persistent memory-optimized, or disk-based (SSD) instance.
-
The instance uses the classic deployment mode and is a Tair (Enterprise Edition) DRAM-based instance that uses the standard architecture or cluster architecture.
You can check the Instance Class in the console to confirm the instance architecture.
Limitations
-
Enable this feature before you need it.
-
Data can be restored to any point within the last seven days, starting from when the feature was enabled.
-
The following operations disable PITR or reset the earliest recovery time point:
-
Changing the instance architecture or migrating to another zone disables PITR. Re-enable the feature to continue using it.
-
Adding or removing data shards in a cluster instance may cause backup inconsistency. Re-enable PITR afterward.
-
Configuration changes or minor version upgrades reset the earliest recoverable time point to when the change completed.
-
-
For cloud-native instances, you can only restore Full data to a new instance. Restoring Specify Key is not supported.
-
If the write rate exceeds 20 MB/s, AOF archiving may be delayed or fail. During a failure, PITR is unavailable until the next successful full backup.
-
With PITR enabled, backups run on the master node instead of the default replica node.
Billing
Point-in-time recovery is currently free during the trial period, supporting recovery from the last seven days. After official release, fees will be based on the recovery time point. Refer to this topic or official announcements for updates.
Restoring to a new instance creates a billable instance. Use the pay-as-you-go billing method and release the instance after verification. For more information, see billable items.
Enable point-in-time recovery
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.
-
In the navigation pane on the left, click Backup and Recovery.
-
On the Backup and Recovery page, click the Data Flashback tab.
-
Click Enable Now.
Enabling PITR requires uploading data and logs. The console displays the estimated completion time.
ImportantOnly data written after PITR is fully enabled can be restored.
Perform a point-in-time recovery
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.
-
In the navigation pane on the left, click Backup and Recovery.
-
On the Backup and Recovery page, click the Data Flashback tab.
-
Click Flashback. In the dialog box that appears, configure the parameters described in the following table.
Parameter
Description
Flashback Data
-
Full data: Restores all data in the instance.
-
Specify Key: Specify the keys to restore. Enter one key name per line. Regular expressions are supported. Examples:
-
Period (.): Matches any single character except
'\r\n'. -
Asterisk (*): Matches the preceding subexpression zero or more times. For example,
h.*llomatcheshlloandheeeello. -
Question mark (?): Matches the preceding subexpression zero or one time. For example,
h.?llomatcheshlloandhello. -
Character set [characters]: Matches any single character within the brackets. For example,
h[ae]llomatcheshalloandhello. -
Negated character set [^characters]: Matches any single character not within the brackets. For example,
h[^ae]llomatcheshclloandhdllo, but nothalloorhello. -
Character range [character1-character2]: Matches characters within the
character1-character2range. For example,h[a-b]llomatcheshalloandhbllo.
NoteTo ensure efficient data recovery, we recommend specifying no more than 10 keys, or no more than 3 keys if you use regular expressions.
-
Recovery mode
-
New instance: Restores data to a new instance.
-
Original instance: Restores data to the current instance.
Flashback Time Point
The point in time to restore data to.
Handle Expired Keys
For classic instances, you can apply an offset to key expiration times during full or specific-key restoration.
-
Default: Key expiration times are not modified. Keys that have already expired at the time of recovery cannot be restored.
-
Time Offset: Adds an offset to key expiration times. Specify an Offset Time. The system calculates each key's remaining TTL at the specified Flashback Time Point and starts the countdown from the offset time.
For example, assume the Flashback Time Point is 10:00:00 on December 12, 2022, and you set the offset time to 10:30:00 on the same day. If the key's remaining TTL at 10:00:00 was 10 seconds, the key will expire at 10:30:10 on December 12, 2022 after it is restored.
NoteThis feature supports TTL offsets only for keys. It does not support offsets for expiration times of elements within Tair's custom data structures, such as fields in exHash or subkeys in TairTS.
The Offset Time cannot be earlier than the specified Flashback Time Point or later than the time you submit the recovery task.
-
-
Click OK.
-
If you set Recovery mode to original instance, the instance enters the Restoring state. Wait until the instance state changes to Running.
-
If you set Recovery mode to new instance, you are redirected to the Clone Instance page. On this page, select the backup time point (the point in time to which you want to restore data) and configure the new instance.
NoteThe new instance must use the standard or cluster architecture with a capacity greater than or equal to the original. For instance creation parameters, see or Create an instance.
-
Related APIs
|
API |
Description |
|
Modifies the automatic backup policy of an instance. Set the EnableBackupLog parameter to enable or disable PITR. PITR also requires AOF persistence to be enabled ( |
|
|
Restores data from a backup to the current instance. With PITR, you can restore specific keys to a precise second. |