2,030   RedHat Redis

Redis 是一款内存型数据库,作为缓存使用,详细介绍:中文站点

 

Redis官方目前只支持Linux,我是在RedHat5.6上安装和测试的,Redis版本是redis-3.0.0

 

一,安装过程:

1,下载Redis源码

$ wget http://download.redis.io/releases/redis-3.0.0.tar.gz

2,解压并安装

$ tar xzf redis-3.0.0.tar.gz

$ cd redis-3.0.0

$ make

$ make install

 

二,启动并测试

1 ,使用脚本后台启动Redis服务端

$ touch start.sh

$ echo ‘nohup src/redis-server /etc/redis/redis.conf &’ > start.sh

$ sh start.sh

2,启动Redis客户端进行测试

$ src/redis-cli

127.0.0.1:6379> set myKey myVal
OK
127.0.0.1:6379> get myKey
“myVal”
127.0.0.1:6379> quit

 

三,报错解决

1,

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

解决方法:
直接修改/etc/sysctl.conf,添加vm.overcommit_memory = 1,重启linux

2,

WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

解决方法:
直接修改 /proc/sys/net/core/somaxconn,改为511,重启linux

 

 




Leave a Reply

Your email address will not be published. Required fields are marked *