0
0
Redisquery~30 mins

Combined RDB + AOF in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Configure Redis for Combined RDB and AOF Persistence
📖 Scenario: You are managing a Redis server that needs to be reliable and fast. To ensure data safety, you want to use both RDB snapshots and AOF (Append Only File) logging together.
🎯 Goal: Configure Redis to save data using both RDB snapshots and AOF logging for better durability and recovery.
📋 What You'll Learn
Create a Redis configuration file named redis.conf.
Enable RDB snapshotting with a save interval of 60 seconds if at least 100 changes occur.
Enable AOF persistence with the appendfsync policy set to every second.
Set the AOF rewrite policy to trigger when the AOF file size is at least twice the size of the rewritten file.
Ensure the configuration file includes both RDB and AOF settings correctly.
💡 Why This Matters
🌍 Real World
Many production Redis servers use combined RDB and AOF persistence to balance performance and data safety.
💼 Career
Knowing how to configure Redis persistence is essential for roles like DevOps engineers, backend developers, and system administrators.
Progress0 / 4 steps
1
Create the Redis configuration file with RDB snapshot settings
Create a file named redis.conf and add the RDB snapshot setting save 60 100 to save the DB every 60 seconds if at least 100 keys changed.
Redis
Need a hint?

The save directive controls RDB snapshot intervals. Use save 60 100 to save every 60 seconds if 100 changes happened.

2
Enable AOF persistence with appendfsync every second
In redis.conf, add the line appendonly yes to enable AOF, and set appendfsync everysec to sync the AOF file every second.
Redis
Need a hint?

Use appendonly yes to turn on AOF and appendfsync everysec to write changes to disk every second.

3
Set AOF rewrite policy to trigger at twice the rewritten file size
Add the line auto-aof-rewrite-percentage 100 and auto-aof-rewrite-min-size 64mb to redis.conf so AOF rewrites when the file grows 100% larger than the last rewrite and is at least 64 megabytes.
Redis
Need a hint?

The auto-aof-rewrite-percentage sets the growth percentage to trigger rewrite. The auto-aof-rewrite-min-size sets the minimum file size for rewrite.

4
Confirm the combined RDB and AOF configuration
Ensure redis.conf contains all these lines: save 60 100, appendonly yes, appendfsync everysec, auto-aof-rewrite-percentage 100, and auto-aof-rewrite-min-size 64mb.
Redis
Need a hint?

Double-check all required lines are in the config file to enable combined RDB and AOF persistence.