Windows环境安装redis-dump

安装msys2-x86_64-20190524.exe

http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190524.exe
rubyinstaller-devkit-2.7.1-1-x64.exe安装后会询问是否安装这个文件,因为下载速度慢,提前安装

安装rubyinstaller-devkit-2.7.1-1-x64.exe

https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-devkit-2.7.1-1-x64.exe
PS C:\Ruby27-x64\bin> .\ridk.cmd install
 _____       _           _____           _        _ _         ___
|  __ \     | |         |_   _|         | |      | | |       |__ \
| |__) |   _| |__  _   _  | |  _ __  ___| |_ __ _| | | ___ _ __ ) |
|  _  / | | | '_ \| | | | | | | '_ \/ __| __/ _` | | |/ _ \ '__/ /
| | \ \ |_| | |_) | |_| |_| |_| | | \__ \ || (_| | | |  __/ | / /_
|_|  \_\__,_|_.__/ \__, |_____|_| |_|___/\__\__,_|_|_|\___|_||____|
                    __/ |           _
                   |___/          _|_ _  __   | | o __  _| _     _
                                   | (_) |    |^| | | |(_|(_)\^/_>

   1 - MSYS2 base installation
   2 - MSYS2 system update (optional)
   3 - MSYS2 and MINGW development toolchain

Which components shall be installed? If unsure press ENTER [1,3]1

通过gem安装redis-dump

gem install --local redis-dump-0.4.0.gem
PS C:\Ruby27-x64\bin> redis-dump --help
  Try: C:/Ruby27-x64/bin/redis-dump show-commands
Usage: C:/Ruby27-x64/bin/redis-dump [global options] COMMAND [command options]
    -u, --uri=S                      Redis URI (e.g. redis://hostname[:port])
    -d, --database=S                 Redis database (e.g. -d 15)
    -a, --password=S                 Redis password (e.g. -a 'my@pass/word')
    -s, --sleep=S                    Sleep for S seconds after dumping (for debugging)
    -c, --count=S                    Chunk size (default: 10000)
    -f, --filter=S                   Filter selected keys (passed directly to redis' KEYS command)
    -b, --base64                     Encode key values as base64 (useful for binary values)
    -O, --without_optimizations      Disable run time optimizations
    -V, --version                    Display version
    -D, --debug
        --nosafe

redis-dump报错

编辑C:\Ruby27-x64\lib\ruby\gems\2.7.0\gems\redis-dump-0.4.0\lib\redis\dump.rb
注释32行ps -o rss= -p #{Process.pid}.to_i # in kb`

导出

redis-dump -u 192.168.56.11:6379 > test.json

导出指定数据库

redis-dump -u 192.168.56.11:6379 -d 15 > test.json

导入

cat .\test.json | redis-load -u 192.168.56.11:6379 -a foobared
type .\test.json | redis-load -u 192.168.56.11:6379 -a foobared

你可能感兴趣的:(数据库,#,Redis,windows,redis,数据库)