Export, import, and restore data instances using Redis-dump in Redis _redis

Source: Internet
Author: User
Tags redis install redis

Redis backup and restore, with the help of a third party tool, Redis-dump

1. Installation Redis-dump

Copy Code code as follows:

[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

Copy Code code as follows:

[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

Copy Code code as follows:

[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 cleared
*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 *//successfully imported
*1
$
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.