Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 370|回复: 0

Redis 5.0.3默认配置启动报错解决方法

[复制链接]
  • TA的每日心情
    奋斗
    2024-4-6 11:05
  • 签到天数: 748 天

    [LV.9]以坛为家II

    2034

    主题

    2092

    帖子

    70万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    705612
    发表于 2021-4-24 00:49:22 | 显示全部楼层 |阅读模式

    一、redis默认配置启动报错误信息如下

    # /usr/local/redis/bin/redis-server /usr/local/src/redis-5.0.3/redis.conf
    5852:C 24 Jan 2019 23:00:07.676 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    5852:C 24 Jan 2019 23:00:07.676 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=5852, just started
    5852:C 24 Jan 2019 23:00:07.676 # Configuration loaded
    5852:M 24 Jan 2019 23:00:07.676 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                    _._
               _.-``__ ''-._
          _.-``    `.  `_.  ''-._           Redis 5.0.3 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 5852
      `-._    `-._  `-./  _.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |           http://redis.io
      `-._    `-._`-.__.-'_.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |
      `-._    `-._`-.__.-'_.-'    _.-'
          `-._    `-.__.-'    _.-'
              `-._        _.-'
                  `-.__.-'
    
    5852:M 24 Jan 2019 23:00:07.677 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    5852:M 24 Jan 2019 23:00:07.677 # Server initialized
    5852:M 24 Jan 2019 23:00:07.677 # 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.
    5852:M 24 Jan 2019 23:00:07.677 # 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.
    5852:M 24 Jan 2019 23:00:07.677 * 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设置128这个值,太小了。
    
    临时生效
    echo 1024 > /proc/sys/net/core/somaxconn
    
    永久生效
    vim /etc/sysctl.conf
    net.core.somaxconn = 1024
    sysctl -p
    
    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参数说明:
    设置内存分配策略(可选,根据服务器的实际情况进行设置)
    /proc/sys/vm/overcommit_memory
    可选值:0、1、2。
    0、表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。
    1、表示内核允许分配所有的物理内存,而不管当前的内存状态如何。
    2、表示内核允许分配超过所有物理内存和交换空间总和的内存
    
    临时生效
    echo 1 > /proc/sys/vm/overcommit_memory
    
    永久生效
    vim /etc/syctl.conf
    vm.overcommit_memory = 1
    sysctl -p
    
    
    3、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.
    
    # 你使用的是透明大页,可能导致redis延迟和内存使用问题。
    
    临时生效
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
    
    永久生效
    vim /etc/rc.local
    if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
        echo never > /sys/kernel/mm/transparent_hugepage/enabled
    fi
    
    chmod +x /etc/rc.local
    

     三、修改后启动无报错状态

    # /usr/local/redis/bin/redis-server /usr/local/src/redis-5.0.3/redis.conf
    1228:C 24 Jan 2019 23:26:50.044 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    1228:C 24 Jan 2019 23:26:50.044 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=1228, just started
    1228:C 24 Jan 2019 23:26:50.044 # Configuration loaded
    1228:M 24 Jan 2019 23:26:50.044 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                    _._
               _.-``__ ''-._
          _.-``    `.  `_.  ''-._           Redis 5.0.3 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 1228
      `-._    `-._  `-./  _.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |           http://redis.io
      `-._    `-._`-.__.-'_.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |
      `-._    `-._`-.__.-'_.-'    _.-'
          `-._    `-.__.-'    _.-'
              `-._        _.-'
                  `-.__.-'
    
    1228:M 24 Jan 2019 23:26:50.045 # Server initialized
    1228:M 24 Jan 2019 23:26:50.045 * DB loaded from disk: 0.000 seconds
    1228:M 24 Jan 2019 23:26:50.045 * Ready to accept connections
    

     

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-5-20 07:08 , Processed in 0.068905 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表