I am new to using Redis and I am playing around a little bit with it. I have noticed that after a little time, let's say 10 minutes all the keys that I inserted just go away.
I just did the default installation showed in the documentation. I didn't configure anything with a redis.config
. Is there any configuration that I need to do so my data can persist?
Environment
Redis Server
Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=557672d61c1e18ba
Redis-cli
redis-cli 6.2.6
Ubuntu 18.08 VM. I have also been using redisInsight to insert the keys.
there are two mechanisms for persisting the data to disk:
if you want to use snapshotting, you need to add the following settings in redis.conf file
with this configuration, redis will dump the data to disk every 60 seconds if at least 1,000 keys changed in that period.
if you want to use aof, you need to add the following settings in redis.conf file
everysecond is the default FYSNC policy. you have also other options.
You can configure your Redis instance to use either of the two mechanisms or a combination of both.