redis 导入导出redis-load,redis-dump详解
Posted lyy3306
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redis 导入导出redis-load,redis-dump详解相关的知识,希望对你有一定的参考价值。
安装redis-dump
[[email protected] ~] yum install ruby rubygems ruby-devel //安装rubygems 以及相关包 [[email protected] ~] gem sources -a http://gems.ruby-china.org/ //源,ruby china加入,外面的源不能访问 http://gems.ruby-china.org/ added to sources [[email protected] ~] gem install redis-dump -V redis-dump导出数据 [[email protected] ~] telnet 127.0.0.1 6379 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is ‘^]‘. set test 11 //设置一个值 +OK get test //取值 $2 11 [[email protected] ~] redis-dump -u :[email protected]:6379 >test.json
redis-load还原数据
[[email protected] ~] 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
[[email protected] ~] < test.json redis-load //导入数据
[[email protected] ~] telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is ‘^]‘.
keys *
*1
$4
test
redis -load 并不能指定端口号 一台多实例 实现不了 redis-loab 指定另一个实例
以上是关于redis 导入导出redis-load,redis-dump详解的主要内容,如果未能解决你的问题,请参考以下文章