Redis backup and restore, with the help of third-party tools, Redis-dump
1, install Redis-dump
[Root@localhost tank]# yum install ruby RubyGems ruby-devel //install RubyGems and related packages
[root@localhost tank]# Gem Sources-a http://ruby.taobao.org/ //source, add Taobao, outside the source can not access
http://ruby.taobao.org/added to sources
[ Root@localhost tank]# gem Install redis-dump-v //install Redis-dump
2,redis-dump Exporting data
[root@localhost tank]# telnet 127.0.0.1 6379//telnet to Redis
Trying 127.0.0.1
... Connected to 127.0.0.1.
Escape character is ' ^] '.
Set test 11//sets a value
+ok
get test//Fetch value
[root@localhost tank]# redis-dump-u 127.0.0.1:6379 >test.json//Export Data
3,redis-load Restoring Data
[root@localhost tank]# telnet 127.0.0.1 6379//telnet to Redis
Trying 127.0.0.1
... Connected to 127.0.0.1.
Escape character is ' ^] '.
Flushall//Please empty all data
+ok
keys *//view emptied
*0
[root@localhost tank]# < Test.json redis-load//import Data
[ Root@localhost tank]# telnet 127.0.0.1 6379
Trying 127.0.0.1 ...
Connected to 127.0.0.1.
Escape character is ' ^] '.
Keys *//IMPORTED successfully * * *
$4