【安装】
yum install ruby rubygems ruby-devel #安装rubygems以及相关包
gem sources -a #加入淘宝
源
gem install redis-dump -V #安装redis-dump
在某台服务器遇到添加淘宝源时报错:
uninitialized constant Gem::RemoteFetcher::OpenSSL
发现在有公网IP的服务器上都安装成功,
这台没有公网IP,应该是这个问题。
修改/etc/redis.conf,配置redis数据落地目录,相对路径容易出问题,一定要使用绝对路径:
dir /data/redis
【导出】
执行以下语句时报错:
redis-dump -u ***:6379 >redis_data_20150821.txt
报错内容:
ERR invalid DB index
改为以下语句,指定0号库,执行成功:
redis-dump -u ***:6379 -d 0 >redis_data_20150821.txt
redis一共有16个库,默认用的是0号库,可以用info命令查看。
【导入】
执行以下语句时报错:
< redis_data_20150821.txt redis-load -u ****:6379
报错内容:
lexical error: invalid bytes in UTF8 string.
改为以下语句,添加 -n 选项(以二进制形式导入)
< redis_data_20150821.txt redis-load -u 10.10.116.133:6379 -n
Loading data with binary strings
If you have binary or serialized data in your Redis database, the YAJL parser may not load your dump file because it sees some of the binary data as 'invalid bytes in UTF8 string'. If you are certain that your data is binary and not malformed UTF8, you can use the -n flag to redis-load to tell YAJL to not check the input for UTF8 validity. Use with caution!
参考资料:
redis-dump
/>
redis 导出 导入 详解
http://blog.51yip.com/nosql/1656.html
=============
=======================================================================================================
redis开机自启动
编写
/etc/init.d/redis,然后执行chkconfig redis on
http://blog.csdn.net/mlks_2008/article/details/19001595
阅读(2226) | 评论(0) | 转发(0) |