标签:redis
1、查看redis key
redis-cli -p6379 #进入管理
keys * #查看所有的key
select 1 #选中1库
keys * #查看1库的所有key
2、redis 导入导出工具
yum -y install ruby rubygems ruby-devel #安装ruby
gen sources --add https://ruby.taobao.org --remove https://rubygems.org #增加淘宝源,删除rubygems源
redis-dump -u 127.0.0.1:6379 > test.json #导出所有
redis-dump -u 192.168.1.1:6379 -d 10 > test10.json #导出10库
< test10.json redis-load -u 192.168.1.1:6379 -d 10 #导入10库
cat test10.json |redis-load -u 192.168.1.1:6379 -d 10 #同上
redis-dump -help
Try: /usr/bin/redis-dump show-commands
Usage: /usr/bin/redis-dump [global options] COMMAND [command options]
-u, --uri=S Redis URI (e.g. redis://hostname[:port])
-d, --database=S Redis database (e.g. -d 15)
-s, --sleep=S Sleep for S seconds after dumping (for debugging)
-c, --count=S Chunk size (default: 10000)
-f, --filter=S Filter selected keys (passed directly to redis‘ KEYS command)
-O, --without_optimizations Disable run time optimizations
-V, --version Display version
-D, --debug
--nosafe
redis-load --help
Try: /usr/bin/redis-load show-commands
Usage: /usr/bin/redis-load [global options] COMMAND [command options]
-u, --uri=S Redis URI (e.g. redis://hostname[:port])
-d, --database=S Redis database (e.g. -d 15)
-s, --sleep=S Sleep for S seconds after dumping (for debugging)
-n, --no_check_utf8
-V, --version Display version
-D, --debug
--nosafe
标签:redis
原文地址:http://314258.blog.51cto.com/304258/1732939