RedisDump is a tool for Redis data import/export. It is based on Ruby implementation, and can easily backup Redis data.
Install Ruby with RVM
RVM is a convenient tool for managing and switching between multiple versions of Ruby environments. Liverpoolfc.tv: RVM. IO /
The redis-dump tool requires Ruby, which can be installed at www.ruby-lang.org/zh_cn/docum… , here lists all the installation methods for all platforms, you can choose the appropriate installation method according to the corresponding platform.
Brew can be used directly for MAC systems
brew install ruby
Copy the code
Install redis-dump
# Remove the gem source
gem sources --remove https://rubygems.org/
# Add Taobao source
gem sources -a https://ruby.taobao.org/
# installed redis - dump
gem install redis-dump -V
Copy the code
Redis-dump imports and exports
Export commandRedis -dump -u 127.0.0.1:6379 > data.jsonExport the specified database dataRedis - dump -u 127.0.0.1:6379-d 15 > data.json
# if redis has a passwordRedis-dump -u :[email protected]:6379 > data.json# import command
cat data.json | redis-load
# if redis has a passwordThe cat data. Json | redis - load - u: [email protected]:6379Copy the code