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

报错内容:

1:C 08 Dec 2023 05:47:33.348 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 08 Dec 2023 05:47:33.348 # Redis version=7.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 08 Dec 2023 05:47:33.348 # Configuration loaded
1:M 08 Dec 2023 05:47:33.349 * monotonic clock: POSIX clock_gettime
1:M 08 Dec 2023 05:47:33.349 * Running mode=standalone, port=16379.
1:M 08 Dec 2023 05:47:33.349 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 08 Dec 2023 05:47:33.349 # Server initialized
1:M 08 Dec 2023 05:47:33.349 # 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.
1:M 08 Dec 2023 05:47:33.350 * Ready to accept connections

报错内容1

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

说明:翻译过来就是  TCP backlog设置值,511没有成功,由于 /proc/sys/net/core/somaxconn这个设置的是更小的128.

解决办法

# 临时解决方法:(即下次启动还须要修改此值)
echo 511 > /proc/sys/net/core/somaxconn

# 永久解决方法:(即之后启动还须要修改此值) 将其写入
/etc/rc.local文件中。

报错内容2

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.

说明:

overcommit_memory参数设置为0!在内存不足的状况下,后台程序save可能失败。

建议在文件 /etc/sysctl.conf 中将overcommit_memory修改成1。

而后重启或运行命令的sysctl vm.overcommit_memory=1'将会生效

# 添加参数
echo "vm.overcommit_memory=1" >> /etc/sysctl.conf

# 加载
sysctl vm.overcommit_memory=1

 

常见故障

故障3

you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue 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 thesetting after a reboot. Redis must be restarted after THP is disabled.
意思是:你使用的是透明大页,可能致使redis延迟和内存使用问题。执行 echo never > /sys/kernel/mm/transparent_hugepage/enabled 修复该问题。
临时解决方法:
echo never > /sys/kernel/mm/transparent_hugepage/enabled。
永久解决方法:
将其写入/etc/rc.local文件中。

故障4

Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
意思是:警告:检测到32位实例,但没有设置内存限制。如今设置3 GB的maxmemory限制。
解决方法:
修改配置文件 redis.conf,将 maxmemory 设置为 maxmemory 751619276

备注:本文档参考与 http://www.javashuo.com/article/p-brambegw-kq.html

 

posted on 2023-12-08 14:20  wangzy-Zj  阅读(239)  评论(0编辑  收藏  举报