Bird
Raised Fist0
Redisquery~5 mins

Combined RDB + AOF in Redis - Cheat Sheet & Quick Revision

Choose your learning style10 modes available
Recall & Review
beginner
What is RDB in Redis?
RDB (Redis Database) is a snapshotting method that saves the dataset to disk at specific intervals. It creates a point-in-time copy of the data.
Click to reveal answer
beginner
What does AOF stand for and what is its purpose in Redis?
AOF stands for Append Only File. It logs every write operation received by the server, allowing Redis to rebuild the dataset by replaying these commands.
Click to reveal answer
intermediate
Why combine RDB and AOF in Redis?
Combining RDB and AOF gives both fast recovery from snapshots (RDB) and a more complete, fine-grained log of changes (AOF), improving durability and performance.
Click to reveal answer
intermediate
How does Redis use RDB and AOF together during restart?
Redis loads the RDB snapshot first for a quick dataset load, then replays the AOF log to apply any changes made after the snapshot, ensuring data is up-to-date.
Click to reveal answer
advanced
What is a key advantage of using AOF with the 'every second' fsync policy?
It balances durability and performance by syncing the AOF file to disk every second, reducing data loss risk while keeping Redis fast.
Click to reveal answer
What does RDB do in Redis?
ACreates snapshots of data at intervals
BLogs every write operation
CDeletes old data automatically
DEncrypts data on disk
What is the main benefit of AOF over RDB?
AFaster snapshot creation
BMore complete data recovery by logging every write
CUses less disk space
DAutomatically compresses data
When Redis restarts using combined RDB + AOF, what happens first?
ARDB snapshot is loaded first
BAOF log is replayed first
CBoth load simultaneously
DData is lost and rebuilt from scratch
Which fsync policy for AOF balances durability and performance?
Afsync always
Bfsync never
Cfsync every minute
Dfsync every second
Why might you use both RDB and AOF in Redis?
ATo encrypt data twice
BTo save disk space
CTo improve data durability and recovery speed
DTo avoid backups
Explain how Redis uses RDB and AOF together to ensure data durability and fast recovery.
Think about what happens during normal operation and after a restart.
You got /5 concepts.
    Describe the advantages and disadvantages of using only RDB or only AOF for Redis persistence.
    Consider data loss risk and recovery speed.
    You got /5 concepts.

      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