A detailed explanation of backup and restore methods for Redis in NoSQL

Source: Internet
Author: User
Tags json redis install redis


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 

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.