Bird
Raised Fist0
Redisquery~10 mins

Combined RDB + AOF in Redis - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to enable both RDB and AOF persistence in Redis.

Redis
redis-cli CONFIG SET [1] yes
Drag options to blanks, or click blank then click option'
Asave
Bappendfsync
Cappendonly
Drdbcompression
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'save' which controls RDB snapshots, not AOF.
Confusing 'appendfsync' which controls fsync frequency.
Using 'rdbcompression' which controls RDB file compression.
2fill in blank
medium

Complete the command to configure Redis to save RDB snapshots every 60 seconds if at least 1000 keys changed.

Redis
redis-cli CONFIG SET save "[1] 1000"
Drag options to blanks, or click blank then click option'
A60
B30
C900
D300
Attempts:
3 left
💡 Hint
Common Mistakes
Using 30 seconds which is too short for this setting.
Using 900 or 300 which are longer intervals.
3fill in blank
hard

Fix the error in the command to set AOF fsync policy to every second.

Redis
redis-cli CONFIG SET appendfsync [1]
Drag options to blanks, or click blank then click option'
Aalways
Bnever
Cno
Deverysec
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'always' which fsyncs after every write and is slower.
Using 'no' or 'never' which disables fsync.
4fill in blank
hard

Fill both blanks to configure Redis to save RDB snapshots every 300 seconds if at least 10 keys changed.

Redis
redis-cli CONFIG SET save "[1] [2]"
Drag options to blanks, or click blank then click option'
A300
B10
C100
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of seconds and changes.
Using too large or too small numbers.
5fill in blank
hard

Fill all three blanks to create a command that enables AOF, sets fsync policy to every second, and configures RDB save interval to 900 seconds with 50 changes.

Redis
redis-cli CONFIG SET [1] yes && redis-cli CONFIG SET appendfsync [2] && redis-cli CONFIG SET save "[3] 50"
Drag options to blanks, or click blank then click option'
Aappendonly
Beverysec
C900
Dsave
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'save' instead of 'appendonly' for enabling AOF.
Using 'always' instead of 'everysec' for fsync.
Using wrong save interval values.

Practice

(1/5)
1. What is the main advantage of using both RDB and AOF persistence together in Redis?
easy
A. It disables data persistence to improve speed.
B. It combines fast startup with high data durability.
C. It reduces memory usage significantly.
D. It automatically compresses all data files.

Solution

  1. Step 1: Understand RDB persistence

    RDB creates snapshots periodically, allowing Redis to start quickly by loading a compact file.
  2. Step 2: Understand AOF persistence

    AOF logs every write operation, ensuring data durability by replaying commands after a restart.
  3. Final Answer:

    It combines fast startup with high data durability. -> Option B
  4. Quick Check:

    Combined RDB + AOF = Fast startup + durability [OK]
Hint: Remember: RDB = snapshots, AOF = logs every write [OK]
Common Mistakes:
  • Thinking combined persistence disables data saving
  • Confusing RDB with AOF roles
  • Assuming combined persistence reduces memory usage
2. Which Redis configuration option enables both RDB snapshots and AOF persistence?
easy
A. appendonly yes and save ""
B. appendonly no and save ""
C. save no and appendonly no
D. appendonly yes and save 900 1

Solution

  1. Step 1: Identify RDB snapshot setting

    The 'save 900 1' means save snapshot if at least 1 change in 900 seconds.
  2. Step 2: Identify AOF setting

    'appendonly yes' enables AOF persistence logging every write.
  3. Final Answer:

    appendonly yes and save 900 1 -> Option D
  4. Quick Check:

    Enable both RDB and AOF with save + appendonly yes [OK]
Hint: Look for appendonly yes plus save with time/count [OK]
Common Mistakes:
  • Setting appendonly no disables AOF
  • Empty save disables RDB snapshots
  • Confusing syntax for save option
3. Given Redis is configured with both RDB and AOF enabled, what happens if Redis crashes after some writes but before the next RDB snapshot?
medium
A. Data is restored from AOF log, including recent writes after last snapshot.
B. Data is restored from the last snapshot only, losing recent writes.
C. Redis starts empty with no data restored.
D. Redis merges partial snapshot and AOF, causing data duplication.

Solution

  1. Step 1: Understand RDB snapshot timing

    RDB snapshots happen periodically, so recent writes after last snapshot are not saved there.
  2. Step 2: Understand AOF recovery

    AOF logs every write, so Redis replays AOF to restore all writes including recent ones.
  3. Final Answer:

    Data is restored from AOF log, including recent writes after last snapshot. -> Option A
  4. Quick Check:

    AOF recovers recent writes missed by RDB [OK]
Hint: AOF logs all writes; RDB snapshots periodically [OK]
Common Mistakes:
  • Assuming only RDB restores data
  • Thinking Redis starts empty after crash
  • Believing Redis merges snapshot and AOF causing duplicates
4. You enabled both RDB and AOF in Redis, but after a restart, some recent data is missing. What is the most likely cause?
medium
A. Redis does not support combined persistence.
B. RDB snapshot interval was set to zero.
C. AOF file was corrupted or disabled during restart.
D. The Redis server was started with wrong port.

Solution

  1. Step 1: Check AOF role in recovery

    AOF logs all writes and is used to restore recent data after restart.
  2. Step 2: Identify cause of missing recent data

    If AOF is corrupted or disabled, recent writes after last snapshot are lost.
  3. Final Answer:

    AOF file was corrupted or disabled during restart. -> Option C
  4. Quick Check:

    Missing recent data usually means AOF problem [OK]
Hint: Check AOF file integrity if recent data missing after restart [OK]
Common Mistakes:
  • Assuming Redis can't combine RDB and AOF
  • Ignoring AOF file corruption possibility
  • Blaming wrong port for data loss
5. You want to optimize Redis persistence by combining RDB snapshots every 15 minutes and AOF with 'everysec' fsync policy. Which statement is true about this setup?
hard
A. This setup balances fast recovery and durability with minimal performance impact.
B. This setup disables AOF fsync, risking data loss on crash.
C. RDB snapshots every 15 minutes cause Redis to block all writes during save.
D. AOF with 'everysec' fsync writes data to disk after every command synchronously.

Solution

  1. Step 1: Understand RDB snapshot interval

    Snapshots every 15 minutes reduce blocking frequency and provide periodic backups.
  2. Step 2: Understand AOF 'everysec' fsync

    'everysec' fsync writes AOF to disk every second asynchronously, balancing durability and performance.
  3. Step 3: Combine effects

    This combination offers fast recovery from snapshots and durability from AOF with low performance cost.
  4. Final Answer:

    This setup balances fast recovery and durability with minimal performance impact. -> Option A
  5. Quick Check:

    RDB + AOF everysec = balanced durability and speed [OK]
Hint: Use RDB for snapshots, AOF everysec for durability and speed [OK]
Common Mistakes:
  • Thinking 'everysec' fsync is synchronous after every command
  • Assuming RDB snapshots block Redis for long every time
  • Believing this setup disables AOF durability
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard