RSS
 

Redis: Converting from RDB to AOF

27 May

This is just a quick note about a question we had that we couldn’t find an easy answer to.

We decided to switch from redis’s default behavior of background saving (bgsave) a .rdb file to using append-only-file (AOF) mode. We thought we could just change the conf and restart, however, it created an empty AOF and was missing all the data from our .rdb.

Apparently the correct way to transition between the two is:
-While running in normal bgsave mode, run:
redis-cli BGREWRITEAOF

When that finishes, shut down the server, change the conf and start it back up. Now all your data should be present, and it should be using the AOF exclusively.

 
 

Leave a Reply

 

 
  1. James Hartig

    May 27, 2010 at 6:51 pm

    I think I remember mentioning this ;) lol

     
  2. Jay

    May 28, 2010 at 2:22 pm

    Too bad my memory sucks. :P

     
  3. Mark Bate

    November 29, 2010 at 5:19 am

    Thanks!
    Spent forever looking through the redis docs trying to figure out how to do this.
    I also tried the IRC channel, but got no response.

    The command is in the redis docs, but it doesn’t make it clear that it can be used in this way.