Merging Redis Databases

Install the redis-rdb-tools and follow the way to export rdb file to command line file:

For example:

$ rdb -c protocol new.rdb.save > new.rdb.cmd
$ rdb -c protocol old.rdb.save > old.rdb.cmd

The cmd file contains the redis commands.

Start a new redis-server with an empty rdb file, and load the two command files with the redis-cli command:

$ cat old.rdb.cmd | redis-cli --pipe
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 2903
$ cat new.rdb.cmd | redis-cli --pipe
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 94

Save the database:

127.0.0.1:6379> save
OK

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues