Manipulating RDB
As we described in the previous recipe, for an in-memory data store such as Redis, enabling persistence features is the best defense against data loss. One obvious way to implement persistence is to take a snapshot against the memory where the data is stored from time to time. That is basically the way RDB works in Redis.
In this recipe, we will take a look at how to perform and configure the RDB persistence feature and learn more about the process of taking the snapshot.
Getting ready…
You need to finish the installation of the Redis Server, as we described in the Downloading and installing Redis recipe in Chapter 1, Getting Started with Redis.
For the purpose of demonstration, we flush all the data with the FLUSHALL
command and then we populate some sample data into our Redis instance by utilizing the redis-random-data-generator tool introduced in the Troubleshooting replication recipe in Chapter 5, Replication:
for i in `seq 10` do nohup node generator.js hash 1000000 session...