redis 安装及启动时警告处理

Posted 会数数的小数点

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redis 安装及启动时警告处理相关的知识,希望对你有一定的参考价值。

  1、redis的安装

    a、  将下载好的redis安装包,解压后,进入文件根目录直接make , 此步完成,make PREFIX=/usr/local/redis  install (PREFIX制定安装路径)

     b、将源码包里的配置文件复制到安装路径 eg: cp   path/redis-5.0.8/redis.conf   path/redis/

 

  2、启动redis

     redis安装目录下   ./bin/redis-server  ./redis.conf

 

 3、启动时警告处理

   a、在启动时redis ,报了三个警告,解决方法来自警告提示,及互联网 ,仅作记录

20525:M 05 Apr 2020 18:34:47.429 # 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 "net.core.somaxconn = 1024" > /etc/sysctl.conf

sysctl -p 

  

b、第二个警告

 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.

解决方式:

echo "vm.overcommit_memory=1" >> /etc/sysctl.conf

sysctl vm.overcommit_memory=1

 

c、第三个警告

 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

  解决方式:

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


vim  /etc/rc.local   //将下面这句话插入到此文件中
   
    echo never > /sys/kernel/mm/transparent_hugepage/enabled

source /etc/rc.local

 

以上是关于redis 安装及启动时警告处理的主要内容,如果未能解决你的问题,请参考以下文章

redis安装后修改三个地方

Homebrew安装Redis找不到redis.conf文件

redis使用及远程连接

怎样使用redis缓存,java代码

redis 安装及启动关闭

redis安装及启动