Redis问题总结
1、 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、1、2。
0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。
1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。
2, 表示内核允许分配超过所有物理内存和交换空间总和的内存
$ vi /etc/sysctl.conf
vm.overcommit_memory = 1
# 配置生效
$ sysctl vm.overcommit_memory=1
2、WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.2021-11-06T08:09:54.882462738Z 1:M 06 Nov 2021 16:09:54.880 # Server initialized
# Docker下配置无效,只能在docker参数上设置才生效
$ vi /etc/sysctl.conf
net.core.somaxconn=1024
# 配置生效
# $ sysctl -p
sysctl net.core.somaxconn=1024
浙公网安备 33010602011771号