博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
redis 导出 导入 详解
阅读量:2388 次
发布时间:2019-05-10

本文共 920 字,大约阅读时间需要 3 分钟。

1,安装redis-dump

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

2,redis-dump导出数据

  1. [root@localhost tank]# telnet 127.0.0.1 6379 //telnet到redis  
  2. Trying 127.0.0.1...  
  3. Connected to 127.0.0.1.  
  4. Escape character is '^]'.  
  5. set test 11 //设置一个值  
  6. +OK  
  7. get test //取值  
  8. $2  
  9. 11  
  10.   
  11. [root@localhost tank]# redis-dump -u 127.0.0.1:6379 >test.json //导出数据  

3,redis-load还原数据

  1. [root@localhost tank]# telnet 127.0.0.1 6379 //telnet到redis  
  2. Trying 127.0.0.1...  
  3. Connected to 127.0.0.1.  
  4. Escape character is '^]'.  
  5. flushall //请空所有数据  
  6. +OK  
  7. keys * //查看已清空  
  8. *0  
  9.   
  10. [root@localhost tank]# < test.json redis-load //导入数据  
  11.   
  12. [root@localhost tank]# telnet 127.0.0.1 6379  
  13. Trying 127.0.0.1...  
  14. Connected to 127.0.0.1.  
  15. Escape character is '^]'.  
  16. keys * //已导入成功  
  17. *1  
  18. $4  
  19. test  

 

转载地址:http://mypab.baihongyu.com/

你可能感兴趣的文章
graudit
查看>>
使用Hudson和FindBugs进行持续集成和代码检查
查看>>
New Tool: The PenTesters Framework (PTF) Released
查看>>
Detecting and Defending against PowerShell Shells
查看>>
NagVis实物监控工具
查看>>
nginx - low risk webdav destination bug
查看>>
Lessons Learned from Building and Running MHN, the World's Largest Crowdsourced Honeynet
查看>>
Logwatch Linux/Unix系统日志检测软件
查看>>
减少Linux下Squid服务器的TIME_WAIT套接字数量
查看>>
/etc/sudoers中的含义
查看>>
Five must-know open source SDN controllers
查看>>
Finding Bad Guys with 35 million Flows, 2 Analysts, 5 Minutes and 0 Dollars
查看>>
SANS FOR572 Logstash
查看>>
apt成熟度模型
查看>>
Digital Forensics Framework v0.4.3 available
查看>>
linux设置bond网卡绑定
查看>>
Is your .svn showing (like 3300 other sites)?
查看>>
PCI DSS Update Could Include Virtualization Security(转载自baoz)
查看>>
List of Windows Auto Start Locations
查看>>
OSSIM 2.1 - Multiple security vulnerabilities
查看>>