Chinaunix首页 | 论坛 | 博客
  • 博客访问: 424256
  • 博文数量: 126
  • 博客积分: 35
  • 博客等级: 民兵
  • 技术积分: 1262
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-19 16:39
文章分类

全部博文(126)

文章存档

2017年(2)

2016年(20)

2015年(64)

2014年(24)

2013年(16)

我的朋友

分类: NOSQL

2015-08-21 15:30:19

【安装】
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



阅读(2141) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~