ApsaraDB for Redis supports the following data persistence methods: Redis Database (RDB) persistence and append-only file (AOF) persistence. This topic describes the features of these persistence methods and how to manage data persistence in the ApsaraDB for Redis console. You can modify persistence settings based on your business requirements.
ApsaraDB for Redis periodically creates snapshots for the data stored in the engine, generates RDB files, and then saves the files to disks. This process is called RDB persistence. RDB files are small in size and easy to migrate. You can use RDB files to back up or migrate ApsaraDB for Redis data at a specified point in time.
By default, ApsaraDB for Redis generates RDB snapshots on a daily basis and retains the snapshots for seven days. You can perform the following operations to manage RDB persistence:
ApsaraDB for Redis records all commands that write data, such as SET. This process is called AOF persistence. When you restart ApsaraDB for Redis, the service reruns the commands in the AOF files to restore data. If AOF files are too large, Redis runs an AOF Rewrite task to recreate AOF files and minimize the size of the AOF file.
You can specify the AOF_FSYNC_EVERYSEC policy to enable AOF persistence in ApsaraDB for Redis. After you specify this policy, the system records all write commands into an AOF file every second and saves the AOF file to disks. The policy has a negligible effect on the performance and can minimize data loss caused by user errors or power outages. ApsaraDB for Redis allows you to archive incremental backups based on AOF files and ensures the service performance when the system runs the AOF Rewrite task.
ApsaraDB for Redis Enhanced Edition (Tair) provides RDB snapshots and the data flashback feature that you can use to back up and restore data. Data flashback optimizes the AOF persistence mechanism and archives incremental AOF files. You can restore the data of an instance or data of specified keys on the instance to a point in time that is accurate to the second. For more information, see Restore data to a point in time by using the data flashback feature.
Data persistence tools
In addition to the preceding methods that you can use to persist data of ApsaraDB for Redis instances in the ApsaraDB for Redis console, you can also use redis-shake to back up an ApsaraDB for Redis instance in real-time synchronization mode. For more information, see Use redis-shak to migrate data from a self-managed Redis database to Alibaba Cloud.