如何将redis数据库从一个服务器移动到另一个服务器? [英] How do I move a redis database from one server to another?
问题描述
我目前有一个运行在一个云实例上的实时redis服务器,我想将这个redis服务器迁移到一个新的云实例,并将该实例用作我的新redis服务器。如果是MySQL,我将从旧服务器导出数据库并将其导入新服务器。我应该怎么做这与redis?
I currently have a live redis server running on a cloud instance and I want to migrate this redis server to a new cloud instance and use that instance as my new redis server. If it were MySQL, I would export the DB from the old server and import it into the new server. How should I do this with redis?
P.S .:我不想设置复制。我想将redis服务器完全迁移到一个新实例。
P.S.: I'm not looking to set-up replication. I want to completely migrate the redis server to a new instance.
推荐答案
将数据库的镜像保存到dump.rdb要么运行 BGSAVE
或 SAVE
。这将在与redis服务器相同的文件夹中创建一个名为dump.rdb的文件。查看所有服务器命令的列表。
Save a spanshot of the database into a dump.rdb by either running BGSAVE
or SAVE
from the command line. This will create a file named dump.rdb in the same folder as your redis server. See a list of all server commands.
复制此dump.rdb到您要迁移到的其他redis服务器。当redis启动时,它会寻找这个文件来初始化数据库。
Copy this dump.rdb to the other redis server you want to migrate to. When redis starts up, it looks for this file to initialize the database from.
这篇关于如何将redis数据库从一个服务器移动到另一个服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!