Home > Database > Mysql Tutorial > body text

redis 导出 导入 详解

WBOY
Release: 2016-06-07 16:40:59
Original
1289 people have browsed it

redis的备份和还原,借助了第三方的工具,redis-dump 1,安装redis-dump [root@localhost tank]# yum install ruby rubygems ruby-devel //安装rubygems 以及相关包[root@localhost tank]# gem sources -a http://ruby.taobao.org/ //源,加入淘宝,外面的源

redis的备份和还原,借助了第三方的工具,redis-dump

1,安装redis-dump

[root@localhost tank]# yum install ruby rubygems ruby-devel   //安装rubygems 以及相关包
[root@localhost tank]# gem sources -a http://ruby.taobao.org/   //源,加入淘宝,外面的源不能访问
http://ruby.taobao.org/ added to sources
[root@localhost tank]# gem install redis-dump -V   //安装redis-dump
Copy after login

2,redis-dump导出数据

[root@localhost tank]# telnet 127.0.0.1 6379 //telnet到redis
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set test 11 //设置一个值
+OK
get test //取值
$2
11
[root@localhost tank]# redis-dump -u 127.0.0.1:6379 >test.json //导出数据
Copy after login

3,redis-load还原数据

[root@localhost tank]# telnet 127.0.0.1 6379 //telnet到redis
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
flushall //请空所有数据
+OK
keys * //查看已清空
*0
[root@localhost tank]# 


    <p class="copyright">
        原文地址:redis 导出 导入 详解, 感谢原作者分享。
    </p>
    
    


Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template