ApsaraDB for Redis supports the following data persistence methods: RDB persistence and append-only file (AOF) persistence. This topic describes the features of these persistence methods and provides guidelines about how to manage data persistence in the console. You can modify persistence settings to serve your workloads.
Based on RDB persistence, ApsaraDB for Redis periodically creates snapshots for the data stored in the engine, generates RDB files, and then saves the files to disks. RDB files consume minimal space to simplify data migration. 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 up to seven days. You can manage RDB persistence in the following ways:
- Configure the point in time for automatic backup. For more information, see Automatic backup.
- Create backups with a few mouse clicks in the console. For more information, see Manual backup.
- Restore data based on RDB files. For more information, see Data recovery.
- Download RDB files. For more information, see Backup archiving.
- Clone an instance based on RDB files. For more information, see Instance cloning.
Based on AOF persistence, ApsaraDB for Redis logs all commands executed to write data, such as SET. 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 the AOF Rewrite task to recreate AOF files and optimize their storage usage.
You can specify the AOF_FSYNC_EVERYSEC policy to enable AOF persistence in ApsaraDB for Redis. Based on this policy, the system logs the commands in write requests by using AOF files on a per-second basis and saves the AOF files to disks. AOF persistence does not decrease the service performance and can minimize data loss caused by user mistakes. ApsaraDB for Redis allows you to archive incremental backups based on AOF files and guarantees the service performance when the system runs the AOF Rewrite task. You can manage AOF persistence in the following ways:
Data persistence tools
You can run the SYNC command of redis-shake to synchronize Redis data in real time and create backups on a destination instance. For more information, see Use redis-shake to migrate data.