本文共 920 字,大约阅读时间需要 3 分钟。
1,安装redis-dump
- [root@localhost tank]# yum install ruby rubygems ruby-devel
-
- [root@localhost tank]# gem sources -a http:
- http:
-
- [root@localhost tank]# gem install redis-dump -V
2,redis-dump导出数据
- [root@localhost tank]# 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
-
- [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
- Trying 127.0.0.1...
- Connected to 127.0.0.1.
- Escape character is '^]'.
- flushall
- +OK
- keys *
- *0
-
- [root@localhost tank]# < 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://mypab.baihongyu.com/