解决Redis通过通过物理机redis图形化客户端访问的三个错误:511,overcommit_memory,you have Transparent Huge Pages (THP) support enabled in your kernel
redis.log中的三个警告
第一个警告:
The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128
.(不能强制执行TCP积压设置511,因为/proc/sys/net/core/somaxconn被设置为较低的值128。)
第二个警告:
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!在内存不足的情况下,后台保存可能失败。要修复此问题,请添加“vm”。Overcommit_memory = 1 '到/etc/sysctl.conf,然后重新启动或运行' sysctl vm. conf '命令。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 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.
(你已经在内核中启用了透明大页面(THP)支持。这将产生延迟和内存使用问题与Redis。要修复这个问题,以root用户运行' echo never > /sys/kernel/mm/transparent_hugepage/enabled '命令,并将其添加到/etc/rc.本地,以便在重新启动后保留设置。禁用THP后,Redis必须重新启动。)
解决方法:一般是做持久化设置
-
第一个警告解决方法:
root账号进入使用命令进入etc目录下
使用命令 vi sysctl.conf 在文件中添加 net.core.somaxconn = 1024 的指令,保存退出后,再执行 sysctl -p 使之生效,操作成功如图所示(修改操作是:找到对应位置,按下字母 i ,可进行编辑,再按下ESC,直接输入冒号 :wq 按下回车键,保存成功)
-
第二个警告解决方法:
root账号进入使用命令进入etc目录下
使用命令 vi sysctl.conf 在文件中添加 vm.overcommit_memory = 1 的指令,保存退出后,再执行 sysctl -p 使之生效,操作成功如图所示
操作成功后,记得重启redis
-
第三个个警告解决方法:
进入到/etc/目录中
将echo never > /sys/kernel/mm/transparent_hugepage/enabled添加rc.local文件中,保存后,再执行source /etc/rc.local生效配置。