Skip to content Skip to sidebar Skip to footer

How To Perform Persistence Store In Redis?

after shutting down the redis server, the values stored using set is destroyed, here i found the way to use the persistence store, anyone help me, how to achieve that using javascr

Solution 1:

You need to configure your Redis server to support a persistency mechanism. This configuration is stored in a file which is given as a parameter on the redis-server command line.

Here is the default file for Redis 2.4: https://github.com/antirez/redis/blob/2.4/redis.conf

Actually two different persistency mechanisms are provided: snapshotting (RDB) and append-only files (AOF). You will find a full explanation here: http://redis.io/topics/persistence

The easiest mechanism is snapshotting (RDB). It can be activated by defining save, dbfilename and dir parameters in the configuration file.

To activate RDB without stopping the Redis server, you can use the following command from the Redis client:

> config set save "300 1"

It will configure RDB to dump everything every 5 min (to be adapted to your own situation).

Please note that you are supposed to use the shutdown command to stop a Redis server. The default behavior is to generate a last snapshot before stopping. The dump file is loaded in memory when Redis starts again.

Should you need to extract data from the dump file (when Redis is offline), you have an excellent Python package at https://github.com/sripathikrishnan/redis-rdb-tools

Post a Comment for "How To Perform Persistence Store In Redis?"