欢迎投稿

今日深度:

redis 导出 导入 详解,redis详解

redis 导出 导入 详解,redis详解


借助了第三方的工具redis-dump

1,安装redis-dump

yum install ruby rubygems ruby-devel -y
gem sources --add http://gems.ruby-china.org/ --remove http://rubygems.org/

gem sources -l

apt-get intsall ruby-dev
gem install redis-dump -V

redis-dump -u 127.0.0.1:6379 > db.json //导出数据
redis-load -u 127.0.0.1:6379 < test.json redis-load //导入数据

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


[root@localhost tank]# redis-dump -u 127.0.0.1:6379 >test.json //导出数据

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


redis-dump -u 127.0.0.1:6379 > db.json //导出数据
redis-load -u 127.0.0.1:6379 < test.json redis-load //导入数据



[root@localhost tank]# telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
keys * //已导入成功
*1
$4
test

 

详细地址:http://delanotes.com/redis-dump/

 


www.htsjk.Com true http://www.htsjk.com/redis/34732.html NewsArticle redis 导出 导入 详解,redis详解 借助了第三方的工具redis-dump 1,安装redis-dump yum install ruby rubygems ruby-devel -ygem sources --add http://gems.ruby-china.org/ --remove http://rubygems.org/gem sources -lapt-get intsal...
相关文章
    暂无相关文章
评论暂时关闭