将Redis数据库与dump.rdb或dump.json文件链接 [英] Linking Redis database with a dump.rdb or dump.json file

查看:169
本文介绍了将Redis数据库与dump.rdb或dump.json文件链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出dump.rdb(或.json格式)文件中现有redis数据库的快照,我想在自己的计算机上还原此数据以对其进行一些测试。

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.

我已尝试尝试分析dump.rdb中的数据,然后手动将其保存在redis数据库中。我觉得有/应该有一种更清洁的方法。

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.

推荐答案

如果要还原整个文件,只需将其复制到 redis.conf 中指定的正确目录,然后重新启动redis服务器。但是,如果要加载密钥/数据库的子集,则必须解析转储文件。

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.

这篇关于将Redis数据库与dump.rdb或dump.json文件链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆