Reputation: 437
I'm newbie with Redis, I tried to delete a key on Ram done, but it has been existed on disk in dumb file. After restart server, the key on Ram has been existed. Please help me. How to sync data between ram and disk?
Upvotes: 0
Views: 1677
Reputation: 562
appendonly yes
appendfsync always
# appendfsync everysec
# append
do like above as Javy said surely is gonna help, this enable the aof and make sure data in ram were synced to disk every second. Another way is issue a BGSAVE command to produce a new dump.rdb file right now. I think you should modify the frequency at which the automatic dump execute. This is in the redis.conf. See the item save.
Guess I'd better post the relative paragraph out for you:
################################ SNAPSHOTTING ################################
#
# Save the DB on disk:
#
# save <seconds> <changes>
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving completely by commenting out all "save" lines.
#
# It is also possible to remove all the previously configured save
# points by adding a save directive with a single empty string argument
# like in the following example:
#
# save ""
If you donot know how to change the config file, type the following command in the specified order:
config set appendonly yes
config set appendonly everysec
config rewrite
If there's anything unclear, feel free to reply.
Upvotes: 1
Reputation: 954
depending on your config file, you can modify your redis config file
, such as
appendonly yes
appendfsync always
# appendfsync everysec
# append
hope that helped.
Upvotes: 1