0
0
Redisquery~20 mins

RDB vs AOF comparison in Redis - Hands-On Comparison

Choose your learning style9 modes available
Understanding Redis Persistence: RDB vs AOF
📖 Scenario: You are managing a Redis database for a small online store. You want to understand how Redis saves data to disk to keep your data safe in case of a crash or restart.
🎯 Goal: Learn how to configure Redis persistence using RDB snapshots and AOF logs, and compare their behavior by setting up both methods.
📋 What You'll Learn
Create a Redis configuration snippet to enable RDB snapshots
Add configuration to enable AOF persistence
Write commands to trigger saving data with RDB
Write commands to check AOF file status
💡 Why This Matters
🌍 Real World
Redis persistence methods like RDB and AOF help keep data safe in real applications such as caching, session storage, and real-time analytics.
💼 Career
Understanding Redis persistence is important for roles like backend developers, DevOps engineers, and database administrators to ensure data durability and recovery.
Progress0 / 4 steps
1
Enable RDB Snapshot Persistence
Create a Redis configuration snippet that enables RDB snapshots by setting save 900 1 to save the DB if at least 1 key changes within 900 seconds, and set dbfilename to dump.rdb.
Redis
Need a hint?

Use the save directive to set snapshot intervals and dbfilename to name the snapshot file.

2
Enable AOF Persistence
Add Redis configuration lines to enable Append Only File (AOF) persistence by setting appendonly yes and appendfilename appendonly.aof.
Redis
Need a hint?

Set appendonly to yes to enable AOF and specify the AOF file name.

3
Trigger RDB Snapshot Save
Write the Redis command SAVE to manually trigger an RDB snapshot save.
Redis
Need a hint?

Use the SAVE command to force Redis to save the DB snapshot immediately.

4
Check AOF File Status
Write the Redis command CONFIG GET appendonly to check if AOF is enabled and CONFIG GET appendfilename to check the AOF file name.
Redis
Need a hint?

Use CONFIG GET with the keys appendonly and appendfilename to check AOF settings.