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 ApsaraDB for Redis 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 and 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 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 Clone an instance.
Based on AOF persistence, ApsaraDB for Redis logs all commands 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 all write commands into an AOF file on a per-second basis and saves the AOF file to disks. The policy has a minor effect on the performance and can minimize data loss caused by user errors or a power outage. 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
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-shake to migrate data.