CentOS 7.2 redis-3.0.5 WARNING solved
启动redis,显示告警如下:
8589:M 05 Dec 14:28:58.509 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
8589:M 05 Dec 14:28:58.509 # Server started, Redis version 3.0.5
8589:M 05 Dec 14:28:58.509 # 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.
8589:M 05 Dec 14:28:58.523 # 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.
解决方法:
# vi /etc/sysctl.conf
追加
-------------------------------------------
vm.overcommit_memory = 1
net.core.somaxconn = 4096
-------------------------------------------
使上述配置生效
# /sbin/sysctl -p
# echo never > /sys/kernel/mm/transparent_hugepage/enabled
# vi /etc/rc.local
追加
-------------------------------------------
echo never > /sys/kernel/mm/transparent_hugepage/enabled
-------------------------------------------
# vi /etc/security/limits.conf
追加如下内容
注:redis是启动redis的操作系统用户
-------------------------------------------
redis hard nofile 64000
redis soft nofile 64000
-------------------------------------------
然后重启redis.