安装redis
获取
http://download.redis.io/releases/wget http://download.redis.io/releases/redis-5.0.4.tar.gz
安装
tar -zxvf redis-5.0.4.tar.gz
cd redis-5.0.4
mv redis-5.0.4 /server/redis
cd /server/redis
make
cp /server/redis/utils/redis_init_script /etc/init.d/redis
vim /etc/init.d/redis
# 修改启动脚本
EXEC=/server/redis/src/redis-server
CLIEXEC=/server/redis/src/redis-cli
CONF="/server/redis/redis.conf"
# 保存
# 启动服务
service redis start
Warning错误处理
- WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
vim /etc/sysctl.conf
# 增加
net.core.somaxconn=1024
# 保存
sysctl -p
- 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.
vim /etc/sysctl.conf
# 增加
vm.overcommit_memory=1
# 保存
sysctl -p
- WARNING you have Transparent Huge Pages (THP) support enabled in your kernel.
This will create latency and memory usage issues with Redis.
To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root,
and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.echo never > /sys/kernel/mm/transparent_hugepage/enabled
安装hireids驱动
获取
https://github.com/redis/hiredis/archive/wget https://github.com/redis/hiredis/archive/v0.14.0.tar.gz
安装
tar -zxvf v0.14.0.tar.gz
cd hiredis-0.14.0/
make -j
make install
ldconfig