Bird
Raised Fist0
Redisquery~10 mins

RDB vs AOF comparison in Redis - Interactive Practice

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

Complete the code to specify the Redis persistence method that saves snapshots of the dataset at intervals.

Redis
redis.conf setting for periodic snapshot saving is [1]
Drag options to blanks, or click blank then click option'
Asave
Bmaxmemory
Cappendonly
Dtimeout
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'appendonly' with snapshot saving
Using 'maxmemory' which controls memory limits
2fill in blank
medium

Complete the code to enable the Redis append-only file persistence.

Redis
To enable AOF, set appendonly to [1] in redis.conf
Drag options to blanks, or click blank then click option'
Ayes
Bno
Cauto
Doff
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'no' or 'off' disables AOF
Using 'auto' is not a valid value
3fill in blank
hard

Fix the error in the command to rewrite the AOF file.

Redis
Use the command [1] to rewrite the appendonly.aof file safely.
Drag options to blanks, or click blank then click option'
AFLUSHALL
BBGREWRITEAOF
CBGSAVE
DSAVE
Attempts:
3 left
💡 Hint
Common Mistakes
Using SAVE or BGSAVE which only affect RDB files
Using FLUSHALL which clears all data
4fill in blank
hard

Fill both blanks to complete the Redis config lines for RDB and AOF persistence.

Redis
save [1]
appendonly [2]
Drag options to blanks, or click blank then click option'
A900 1
Byes
Cno
D300 10
Attempts:
3 left
💡 Hint
Common Mistakes
Putting 'no' for appendonly disables AOF
Using invalid save intervals
5fill in blank
hard

Fill all three blanks to complete the Redis config for AOF fsync policy and RDB snapshot interval.

Redis
appendonly [1]
appendfsync [2]
save [3]
Drag options to blanks, or click blank then click option'
Ayes
Beverysec
C900 1
Dno
Attempts:
3 left
💡 Hint
Common Mistakes
Setting appendonly to no disables AOF
Using 'always' or 'no' for appendfsync instead of 'everysec'

Practice

(1/5)
1. Which Redis persistence method saves the entire dataset at specific time intervals?
easy
A. AOF (Append Only File)
B. RDB (Redis Database snapshot)
C. Both RDB and AOF save snapshots
D. Neither RDB nor AOF save snapshots

Solution

  1. Step 1: Understand RDB persistence

    RDB saves the dataset by creating snapshots at set intervals.
  2. Step 2: Compare with AOF

    AOF logs every write operation, not snapshots.
  3. Final Answer:

    RDB (Redis Database snapshot) -> Option B
  4. Quick Check:

    Snapshot saving = RDB [OK]
Hint: RDB = snapshots at intervals, AOF = logs every change [OK]
Common Mistakes:
  • Confusing AOF with snapshot saving
  • Thinking both save snapshots
  • Believing neither saves snapshots
2. Which of the following is the correct Redis command to enable AOF persistence?
easy
A. CONFIG SET appendonly yes
B. CONFIG SET save "900 1 300 10 60 10000"
C. CONFIG SET rdbcompression no
D. CONFIG SET maxmemory-policy allkeys-lru

Solution

  1. Step 1: Identify AOF enabling command

    The command to enable AOF is CONFIG SET appendonly yes.
  2. Step 2: Check other options

    CONFIG SET save "900 1 300 10 60 10000" sets RDB save intervals, C disables RDB compression, D sets memory eviction policy.
  3. Final Answer:

    CONFIG SET appendonly yes -> Option A
  4. Quick Check:

    Enable AOF = appendonly yes [OK]
Hint: Enable AOF with 'appendonly yes' command [OK]
Common Mistakes:
  • Confusing RDB save command with AOF
  • Using unrelated config commands
  • Forgetting to set appendonly to yes
3. Given Redis configured with AOF enabled and fsync set to 'everysec', what is the expected data durability behavior?
medium
A. Data is saved only at intervals, risking data loss of last seconds
B. Every write is immediately saved to disk, no data loss
C. Data is never saved to disk automatically
D. Data is saved only when Redis restarts

Solution

  1. Step 1: Understand AOF with fsync everysec

    With fsync set to 'everysec', Redis writes AOF data to disk every second.
  2. Step 2: Analyze durability implications

    This means data could be lost if Redis crashes within the last second before fsync.
  3. Final Answer:

    Data is saved only at intervals, risking data loss of last seconds -> Option A
  4. Quick Check:

    AOF everysec fsync = possible 1-second data loss [OK]
Hint: AOF everysec fsync means possible 1-second data loss [OK]
Common Mistakes:
  • Assuming every write is immediately saved
  • Thinking data is never saved automatically
  • Confusing with no persistence
4. You enabled both RDB and AOF persistence in Redis, but after a crash, data is missing. What is the most likely cause?
medium
A. Redis does not support using both RDB and AOF together
B. Redis was not restarted after enabling persistence
C. RDB snapshot interval is too long, losing recent changes
D. AOF file is corrupted and Redis cannot load it

Solution

  1. Step 1: Understand RDB and AOF coexistence

    Redis supports both RDB and AOF, preferring to load AOF first on restart if available.
  2. Step 2: Analyze data loss causes

    With both enabled, if data is missing after a crash, the most likely cause is AOF corruption, causing fallback to the older RDB snapshot and loss of recent changes.
  3. Final Answer:

    AOF file is corrupted and Redis cannot load it -> Option D
  4. Quick Check:

    Data loss with both = AOF corrupted [OK]
Hint: With both enabled, data loss likely from AOF corruption [OK]
Common Mistakes:
  • Believing Redis can't use both persistences
  • Thinking RDB interval too long is the cause
  • Forgetting to restart Redis
5. You want Redis to recover data quickly after a crash but can tolerate losing up to 1 minute of recent writes. Which persistence setup is best?
hard
A. Enable AOF with fsync always, disable RDB
B. Enable both RDB and AOF with fsync everysec
C. Enable RDB snapshots every 60 seconds, disable AOF
D. Disable both RDB and AOF for fastest performance

Solution

  1. Step 1: Match recovery speed and data loss tolerance

    RDB snapshots every 60 seconds allow fast recovery but may lose up to 1 minute of data.
  2. Step 2: Compare with AOF options

    AOF with fsync always is slower but safer; both enabled adds overhead; disabling persistence risks total data loss.
  3. Final Answer:

    Enable RDB snapshots every 60 seconds, disable AOF -> Option C
  4. Quick Check:

    Fast recovery + 1 min loss = RDB every 60s [OK]
Hint: RDB snapshots match fast recovery with some data loss [OK]
Common Mistakes:
  • Choosing AOF for fast recovery despite slower startup
  • Enabling both causing unnecessary overhead
  • Disabling persistence risking total data loss
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