A detailed introduction to Redis data export

Source: Internet
Author: User
Tags json redis install redis
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  






Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.