redis警告优化

警告1:maximum open files过低

8430:M 04 Jul 2021 22:09:57.590 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
8430:M 04 Jul 2021 22:09:57.590 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
8430:M 04 Jul 2021 22:09:57.590 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.

解决方法:启动文件添加参数

vim /usr/lib/systemd/system/redis.service

LimitNOFILE=65536

 

 

警告2:

8430:M 04 Jul 2021 22:09:57.591 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

解决方法:

echo "511" > /proc/sys/net/core/somaxconn

sysctl net.core.somaxconn=4096

 

警告3:overcommit_memory设置 虚拟内存相关

8430:M 04 Jul 2021 22:09:57.591 # 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.

解决方法:

sysctl vm.overcommit_memory=1

 

警告4:关闭THP大内存页

8430:M 04 Jul 2021 22:09:57.591 # 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.

 解决方法:

1临时解决方法

echo never > /sys/kernel/mm/transparent_hugepage/enabled

2开机自启设置

vim /etc/rc.d/rc.local

echo never > /sys/kernel/mm/transparent_hugepage/enabled

chmod +x /etc/rc.d/rc.local

 

 

posted on 2021-07-04 22:37  弓长三寿  阅读(1351)  评论(0)    收藏  举报