Persistence
Since the beginning of this book, we have talked a lot about storing your data in memory using Redis. Memory is transient. Therefore, if a Redis instance is shut down, crashes, or needs to be rebooted, all of the stored data will be lost. To solve this problem, Redis provides two mechanisms to deal with persistence: Redis Database (RDB) and Append-only File (AOF). Both of these mechanisms can be used separately or simultaneously in the same Redis instance.
The persistence approach used by Redis has generated a lot of discussion in the community. On March 26, 2012, Salvatore Sanfilippo wrote a great blog post demystifying persistence in Redis, since persistence was the most misunderstood feature of Redis.
Note
Recommended reading
Redis persistence demystified at http://oldblog.antirez.com/post/redis-persistence-demystified.html.
In this section, we will cover the advantages and disadvantages of each approach as well as how each can be enabled.
RDB (Redis Database)
A .rdb file is a...