You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
just enabling the AOF after we had been using the instance for a while, seems weird that it would favour an empty file over the rdb, what's the recommended way to trick it into loading the rdb at least the first time and then having it write to the AOF?
@yihuang I don't think so, probably the config rewrite failed? If AOF is not able to accept writes Redis returns errors on writes. It's more likely that rewrite reported an unnoticed error and on restart there was still the old config supposed to load an RDB file.
[20428] 21 Jun 16:42:55.537 * DB saved on disk
[20428] 21 Jun 16:42:55.538 * RDB: 0 MB of memory used by copy-on-write
[20109] 21 Jun 16:42:55.578 * Background saving terminated with success
[20109] 21 Jun 16:43:30.741 * Background append only file rewriting started by pid 20486
[20109] 21 Jun 16:43:30.747 # CONFIG REWRITE executed with success.
[20109] 21 Jun 16:43:30.756 # User requested shutdown...
[20109] 21 Jun 16:43:30.756 # There is a child rewriting the AOF. Killing it!
[20109] 21 Jun 16:43:30.756 * Calling fsync() on the AOF file.
[20109] 21 Jun 16:43:30.931 * Saving the final RDB snapshot before exiting.
[20109] 21 Jun 16:43:31.910 * DB saved on disk
[20109] 21 Jun 16:43:31.910 * Removing the pid file.
[20109] 21 Jun 16:43:31.910 # Redis is now ready to exit, bye bye...
@yihuang normally shutting down during AOF rewrite is safe, but once you enable it, your initial AOF is non-existing, so you need to wait for the rewrite to end actually. Btw this may well be considered a bug, in which, probably Redis should refuse to shutdown if there is a rewrite in progress that is the initial rewrite after the switch.
Activity
charsyam commentedon Jun 19, 2014
@visionmedia if you enable AOF and RDB. Redis will choose AOF load not RDB.
antirez commentedon Jun 19, 2014
Hello, just set
appendonly noin the Redis config file, restart, to enable AOF do:Done.
tj commentedon Jun 19, 2014
nvm,
config set appendonly yesdoes the tricktj commentedon Jun 19, 2014
oh didn't refresh hahaha thanks for the quick answer
antirez commentedon Jun 19, 2014
yw ;-)
antirez commentedon Jun 19, 2014
p.s. remember to rewrite or alter the config, otherwise the next restart you'll have a bad surprise.
yihuang commentedon Jun 21, 2014
We've met a problem, we had an instance running for a while, then we
then we restart, we found data is lost. I think maybe because the aof file don't contains all the data?
antirez commentedon Jun 21, 2014
@yihuang I don't think so, probably the config rewrite failed? If AOF is not able to accept writes Redis returns errors on writes. It's more likely that rewrite reported an unnoticed error and on restart there was still the old config supposed to load an RDB file.
yihuang commentedon Jun 21, 2014
@antirez I known what happened, we shutdown redis server immediately after set aof, then the aof file is left incomplete. I just reproduced it.
This is the log:
yihuang commentedon Jun 21, 2014
I guess shutdown should wait for aof rewriting process exit.
antirez commentedon Jun 21, 2014
@yihuang normally shutting down during AOF rewrite is safe, but once you enable it, your initial AOF is non-existing, so you need to wait for the rewrite to end actually. Btw this may well be considered a bug, in which, probably Redis should refuse to shutdown if there is a rewrite in progress that is the initial rewrite after the switch.