1.下载安装包
http://download.redis.io/releases/redis-3.2.6.tar.gz http://download.redis.io/releases/
2.更新现有linux环境
sudo yum –y update; sudo yum -y install telnet curl nmap vim gcc gcc-c++ tcl ruby;
3.安装
1 tar -xvf redis-3.2.6.tar.gz 2 cd redis-3.2.6 3 make4 make test 5 sudo make install
4.优化redis目录
a.移动不使用的文件
1 mkdir others 2 mv 00-RELEASENOTES BUGS CONTRIBUTING COPYING INSTALL Makefile MANIFESTO README.md runtest runtest-cluster runtest-sentinel others/
b.创建配置文件目录与启动脚本目录
mkdir conf mv redis.conf conf/ mv sentinel.conf conf/ mkdir bin cd src mv redis-server redis-cli redis-sentinel ../bin
c.创建pid文件与日志目录
1 mkdir run 6379 26379 logs 2 touch ./run/redis_6379.pid 3 touch ./run/redis_26379.pid 4 touch ./logs/redis_6379.log 5 touch ./logs/redis_26379.log
错误解决:
1.第3步make 报错
missing initializer for field ‘longitude’ of ‘GeoHashArea’
可以使用
make MALLOC=libc 替换 make
2.make test 报错
*** [err]: Test replication partial resync: ok psync (diskless: yes, reconnect: 1) in tests/integration/replication-psync.tcl Expected condition '[s -1 sync_partial_ok] > 0' to be true ([s -1 sync_partial_ok] > 0) Cleanup: may take some time... OK make[1]: *** [test] Error 1
redis 安装在vmware虚拟机上会出现这个错误,在实体机以及阿里云不会出现,解决方法是vi tests/integration/replication-psync.tcl 根据报错提示将after后面的数字,从100改成 500。
一定要显示
o/ All tests passed without errors!
这样的提示。