Redis服务器启动3个警告信息的解决方案
##################################################################################
第一个警告信息:The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
第二个警告信息: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文件,在文件末尾加入以下两句
net.core.somaxconn=1024
vm.overcommit_memory=1
第三个警告信息: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.
方式一:
1.编辑 /etc/default/grub,在GRUB_CMDLINE_LINUX加入选项 transparent_hugepage=never
2.
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_DISABLE_RECOVERY="true"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rhgb quiet transparent_hugepage=never"
3.重新生成grub配置文件
4.如果你使用的是grub,请把选项写入grub.conf文件就好了,然后重启系统
5. 查询hugepage状态
方式二