Linking Redis database with a dump.rdb or dump.json file

若如初见. 提交于 2020-01-04 14:18:07

问题


Given a snapshot of an existing redis database in a dump.rdb (or in .json format) file, I want to restore this data in my own machine to run some tests on it.

Any pointers on how to do this would be greatly appreciated.

I have resorted to trying to parse the data in the dump.rdb and then save it in a redis DB manually. I feel like there is/should be a cleaner way.


回答1:


If you want to restore the entire file, simply copy it to the right directory specified in redis.conf and restart redis server. But if you want to load a subset of keys/databases, you'd have to parse the dump file.




回答2:


SO:

I continued doing it the "hacky" way and found that using the parser code found here: https://github.com/sripathikrishnan/redis-rdb-tools was a great help.

using the parser sample code i could: 1) set up a redis client 2) use the parser to parse the data 3) use the client to "set" parsed data into a new redis database.




回答3:


the rdd tools can also do that,

it work independantly of .rdb files and dump/restore working redis instances

it can apply merge, split, rename, search, filter, insert, delete on dumps and/or redis



来源:https://stackoverflow.com/questions/10842470/linking-redis-database-with-a-dump-rdb-or-dump-json-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!