Edis backup and restore, with the help of a third party tool, Redis-dump
1, install Redis-dump
The code is as follows |
Copy Code |
[Root@localhost tank]# yum install ruby rubygems ruby-devel/installation 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//installation Redis-dump
|
2,redis-dump Export Data
The code is as follows |
Copy Code |
[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//Set a value +ok Get test//Take value $ 11
[Root@localhost tank]# redis-dump-u 127.0.0.1:6379 >test.json//Export Data 3,redis-load Restore Data [root@localhost tank]# telnet 127.0.0.1 6379//telnet to redis trying 127.0.0.1... to 127. 0.0.1. Escape character is ' ^] ' . Flushall//Please empty all data +ok Keys *//view cleared *0 [root@localhost tank]# < Test.json redis-load//Import data [Root@localhos T tank]# telnet 127.0.0.1 6379 Trying 127.0.0.1... Connected to 127.0.0.1. Escape charact Er is ' ^] ' . Keys *//Imported successfully *1 $4 test |