Redis is an in-memory database. What is the main reason to enable persistence in Redis?
Think about what happens if the server loses power suddenly.
Persistence saves data to disk so Redis can recover data after a restart or crash. Without persistence, all data in memory would be lost.
Assume Redis is running without any persistence enabled. You add a key-value pair user:1 -> 'Alice'. Then the server crashes and restarts. What will be the result of GET user:1 after restart?
Consider what happens to in-memory data when the server restarts without saving it.
Without persistence, Redis only keeps data in memory. On restart, memory is cleared, so keys are lost and GET returns null.
Which command configures Redis to save snapshots of the dataset to disk at regular intervals?
Think about how to configure automatic snapshot intervals.
CONFIG SET save sets the snapshotting intervals in Redis configuration. SAVE and BGSAVE trigger immediate snapshots. PERSIST removes expiration from keys.
You want Redis to persist data but minimize performance impact. Which persistence method balances durability and speed best?
Consider how often data is written to disk and its effect on speed.
AOF with fsync every second writes data asynchronously, providing good durability with less performance cost than fsync always. RDB snapshots are faster but less durable. No persistence risks data loss.
You enabled both RDB snapshots and AOF persistence in Redis. However, after a server crash, some recent writes are missing. What is the most likely cause?
Check how often Redis flushes AOF data to disk.
If AOF fsync is set to 'no', Redis buffers writes in memory and writes to disk less frequently, risking data loss on crash. RDB and AOF can be combined safely. Server crash timing matters.