user1429575
user1429575

Reputation: 31

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

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.

Upvotes: 2

Views: 4002

Answers (3)

r043v
r043v

Reputation: 1869

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

Upvotes: 0

user1429575
user1429575

Reputation: 31

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.

Upvotes: 1

Sripathi Krishnan
Sripathi Krishnan

Reputation: 31528

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.

Upvotes: 3

Related Questions