3

windows 使用 redis-dump备份数据

 2 years ago
source link: http://www.hechunbo.com/index.php/archives/404.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

windows redis-dump备份数据

  1. 先安装ruby
    官方下载地址:https://rubyinstaller.org/downloads/ 带DEVKIT的安装包

如果安装完, 弹出直接安装msys2的时候, 先取消,因为会直接网络上下载msys2, 但是国内网格不好,导致可能会有好多失败的地方

  1. 再安装msys2
    https://www.msys2.org/#installation
  2. 在cmd下运行ridk install 输入数字1,
    出现properly installed 安装完成
  3. 再次安装Redis-dump
    cmd下输入 gem install redis-dump , 就可以了.
  4. 改配置文件
    去ruby的安装目录d:Ruby27-x64librubygems2.7.0gemsredis-dump-0.4libredis目录下打开dump.rb文件

在第32行的 ps -o 开头的注释掉, 在方法def memory_usage中.

  1. 开始备份数据

    #保存redis中的db8到db8.json这个文件
    #保存后的文件在c:\用户\user下. 
    redis-dump -u 127.0.0.1:6379 -d 8 >db8.json 
    
    
  2. 安装redis-load
    gem install redis-load
  3. 导入
    <db8.json redis-load -u redis://192.168.1.1:6379 -d 2

这里可能会报错.暂时还没解决

creativecommons-cc.png
本文由 hcb 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK