What does persistence mean in the context of Redis?
Persistence means saving data on disk so it is not lost when Redis restarts or crashes.
Click to reveal answer
beginner
Why is persistence important for Redis users?
Persistence is important because it protects data from being lost during power failures or server restarts.
Click to reveal answer
intermediate
Name two common persistence methods used by Redis.
Redis uses RDB snapshots and AOF (Append Only File) to save data persistently.
Click to reveal answer
beginner
What happens if Redis runs without persistence enabled?
If persistence is off, all data is lost when Redis stops or crashes because it only stores data in memory.
Click to reveal answer
intermediate
How does persistence affect Redis performance?
Persistence can slow Redis slightly because it writes data to disk, but it ensures data safety.
Click to reveal answer
What is the main purpose of persistence in Redis?
ATo save data permanently on disk
BTo speed up data retrieval
CTo compress data in memory
DTo encrypt data automatically
✗ Incorrect
Persistence saves data on disk so it is not lost after Redis restarts.
Which Redis persistence method saves snapshots of data at intervals?
AAOF (Append Only File)
BData sharding
CMemory caching
DRDB (Redis Database) snapshots
✗ Incorrect
RDB snapshots save the entire dataset at specific times.
What risk do you face if Redis persistence is disabled?
AData will be duplicated
BData will be lost on restart
CData will be encrypted
DData will be slower to access
✗ Incorrect
Without persistence, Redis stores data only in memory, so data is lost if Redis stops.
How does enabling persistence affect Redis performance?
AIt slightly slows Redis due to disk writes
BIt makes Redis faster
CIt disables caching
DIt compresses data automatically
✗ Incorrect
Writing data to disk takes time, so persistence can slow Redis a bit.
Which persistence method appends every write command to a file?
ARDB snapshots
BMemory snapshot
CAOF (Append Only File)
DDisk caching
✗ Incorrect
AOF logs every write command to keep data safe.
Explain why persistence is important in Redis and what could happen without it.
Think about what happens when the server restarts or crashes.
You got /4 concepts.
Describe the two main persistence methods Redis uses and how they differ.
One saves snapshots, the other logs commands.
You got /4 concepts.
Practice
(1/5)
1. Why is persistence important in Redis?
easy
A. It encrypts data for security during transmission.
B. It speeds up data retrieval by caching in memory.
C. It saves data to disk to prevent data loss after a restart.
D. It automatically deletes old data to free memory.
Solution
Step 1: Understand persistence purpose
Persistence means saving data to disk so it is not lost when Redis restarts or crashes.
Step 2: Compare options
Only the option stating 'It saves data to disk to prevent data loss after a restart.' describes saving data to disk to prevent loss. Others describe caching, deleting, or encryption, which are unrelated to persistence.
Final Answer:
It saves data to disk to prevent data loss after a restart. -> Option C
Quick Check:
Persistence = saving data safely [OK]
Hint: Persistence means saving data to disk to avoid loss [OK]
Common Mistakes:
Confusing persistence with caching
Thinking persistence deletes data
Mixing persistence with encryption
2. Which Redis configuration option controls how often data is saved to disk?
easy
A. save
B. maxmemory-policy
C. appendonly
D. timeout
Solution
Step 1: Identify persistence settings
Redis uses the save option to specify intervals for saving snapshots to disk.
Step 2: Eliminate other options
maxmemory-policy controls eviction, appendonly enables AOF persistence, and timeout sets client timeout, not snapshot frequency.
Final Answer:
save -> Option A
Quick Check:
save = snapshot frequency setting [OK]
Hint: Remember 'save' sets snapshot intervals in Redis config [OK]
Common Mistakes:
Confusing appendonly with save
Thinking maxmemory-policy controls saving
Mixing timeout with persistence
3. Given this Redis config snippet:
save 900 1
save 300 10
save 60 10000
What does this configuration mean?
medium
A. Save data every 900 seconds if at least 1 key changed, every 300 seconds if 10 keys changed, and every 60 seconds if 10000 keys changed.
B. Save data every 900 seconds regardless of changes, every 300 seconds if 10 keys changed, and every 60 seconds if 10000 keys changed.
C. Save data only once after 900 seconds, ignoring key changes.
D. Save data every 900 seconds if 900 keys changed, every 300 seconds if 300 keys changed, and every 60 seconds if 60 keys changed.
Solution
Step 1: Understand Redis save syntax
Each line means: save after X seconds if at least Y keys changed. For example, save 900 1 means save after 900 seconds if 1 or more keys changed.
Step 2: Match lines to meaning
Lines specify different intervals and minimum changed keys: 900s/1 key, 300s/10 keys, 60s/10000 keys.
Final Answer:
Save data every 900 seconds if at least 1 key changed, every 300 seconds if 10 keys changed, and every 60 seconds if 10000 keys changed. -> Option A
Quick Check:
save X Y means save after X seconds if Y keys changed [OK]
Hint: Remember save X Y means save after X seconds if Y keys changed [OK]
Common Mistakes:
Ignoring the minimum changed keys condition
Assuming save happens regardless of changes
Mixing seconds and keys numbers
4. You set appendonly yes in Redis config but data is not saved after restart. What is the likely problem?
medium
A. The appendfsync setting is set to 'no', so AOF is disabled.
B. The Redis server was not restarted after changing the config.
C. The save option must be enabled for AOF to work.
D. The appendonly.aof file is missing or corrupted.
Solution
Step 1: Understand AOF persistence
Setting appendonly yes enables AOF persistence, which logs every write operation to a file.
Step 2: Identify why data might not persist
If the AOF file is missing or corrupted, Redis cannot restore data on restart, causing data loss despite the setting.
Final Answer:
The appendonly.aof file is missing or corrupted. -> Option D
Quick Check:
AOF file missing = no data restored [OK]
Hint: Check if AOF file exists and is valid when appendonly is yes [OK]
5. You want to ensure Redis never loses more than 5 minutes of data after a crash. Which persistence setup is best?
hard
A. Enable RDB snapshots every 900 seconds and disable AOF.
B. Enable both RDB snapshots every 300 seconds and AOF with appendfsync 'everysec'.
C. Enable AOF with appendfsync set to 'everysec' and disable RDB snapshots.
D. Disable both RDB and AOF to improve performance.
Solution
Step 1: Understand persistence options
RDB snapshots save data at intervals (e.g., every 300 seconds). AOF logs every write and can fsync every second.
Step 2: Match requirement to config
To lose no more than 5 minutes (300 seconds) of data, snapshots alone are risky. Combining snapshots every 300s with AOF fsync every second minimizes data loss.
Step 3: Evaluate options
The option to enable both RDB snapshots every 300 seconds and AOF with appendfsync 'everysec' enables both methods with appropriate intervals, ensuring minimal data loss. Others either save less often or disable persistence.
Final Answer:
Enable both RDB snapshots every 300 seconds and AOF with appendfsync 'everysec'. -> Option B
Quick Check:
Combine snapshots + AOF for best data safety [OK]
Hint: Use both snapshots and AOF for minimal data loss [OK]
Common Mistakes:
Relying on snapshots alone for short data loss windows
Disabling persistence to improve speed
Setting appendfsync to 'no' or 'always' incorrectly
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.