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 javascript ?
I wanna store some values from clients in redis db, and have to use that value in other clients.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With