How can I force Redis to do a blocking save? I am using the Ruby Redis gem, but I believe this question is not specific to that library. It seems like SAVE and a BGSAVE commands seem to flutter away doing stuff in the background, causing "-ERR background save in progress" errors on subsequent calls.
Hopefully this would be a boring, synchronous call that blocks all other Redis commands until the save over "dump.rdb" is finished. And hopefully this will not require actually shutting down the server, mucking around with "/etc/init.d/redis-server". Presumably I should be polling with the LASTSAVE command?
if you call SAVE but you get an error about a background save in progress, this means that there is also a BGSAVE in progress, becuase one of this is true:
1) Somebody called BGSAVE 2) Redis is configured to save from time to time (the default).
So your SAVE fails since there is already a save in progress. You can check if there is a background in progress, and when it is completed, checking the INFO output.
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