Java学习者论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

恭喜Java学习者论坛(https://www.javaxxz.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入门到精通教程
查看: 179|回复: 0

[默认分类] Redis 5.0.3默认配置启动报错解决方法

[复制链接]
  • TA的每日心情
    开心
    2021-12-13 21:45
  • 签到天数: 15 天

    [LV.4]偶尔看看III

    发表于 2020-8-14 12:08:06 | 显示全部楼层 |阅读模式
    一、redis默认配置启动报错误信息如下

    1. # /usr/local/redis/bin/redis-server /usr/local/src/redis-5.0.3/redis.conf
    2. 5852:C 24 Jan 2019 23:00:07.676 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    3. 5852:C 24 Jan 2019 23:00:07.676 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=5852, just started
    4. 5852:C 24 Jan 2019 23:00:07.676 # Configuration loaded
    5. 5852:M 24 Jan 2019 23:00:07.676 * Increased maximum number of open files to 10032 (it was originally set to 1024).
    6.                 _._
    7.            _.-``__ ""-._
    8.       _.-``    `.  `_.  ""-._           Redis 5.0.3 (00000000/0) 64 bit
    9.   .-`` .-```.  ```\/    _.,_ ""-._
    10. (    "      ,       .-`  | `,    )     Running in standalone mode
    11. |`-._`-...-` __...-.``-._|"` _.-"|     Port: 6379
    12. |    `-._   `._    /     _.-"    |     PID: 5852
    13.   `-._    `-._  `-./  _.-"    _.-"
    14. |`-._`-._    `-.__.-"    _.-"_.-"|
    15. |    `-._`-._        _.-"_.-"    |           http://redis.io
    16.   `-._    `-._`-.__.-"_.-"    _.-"
    17. |`-._`-._    `-.__.-"    _.-"_.-"|
    18. |    `-._`-._        _.-"_.-"    |
    19.   `-._    `-._`-.__.-"_.-"    _.-"
    20.       `-._    `-.__.-"    _.-"
    21.           `-._        _.-"
    22.               `-.__.-"
    23. 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.
    24. 5852:M 24 Jan 2019 23:00:07.677 # Server initialized
    25. 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.
    26. 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.
    27. 5852:M 24 Jan 2019 23:00:07.677 * Ready to accept connections
    复制代码


    二、解决方法

    1. 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.
    2. # 对一个高负载的环境来说tcp设置128这个值,太小了。
    3. 临时生效
    4. echo 1024 > /proc/sys/net/core/somaxconn
    5. 永久生效
    6. vim /etc/sysctl.conf
    7. net.core.somaxconn = 1024
    8. sysctl -p
    9. 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.
    10. # overcommit_memory参数说明:
    11. 设置内存分配策略(可选,根据服务器的实际情况进行设置)
    12. /proc/sys/vm/overcommit_memory
    13. 可选值:0、1、2。
    14. 0、表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。
    15. 1、表示内核允许分配所有的物理内存,而不管当前的内存状态如何。
    16. 2、表示内核允许分配超过所有物理内存和交换空间总和的内存
    17. 临时生效
    18. echo 1 > /proc/sys/vm/overcommit_memory
    19. 永久生效
    20. vim /etc/syctl.conf
    21. vm.overcommit_memory = 1
    22. sysctl -p
    23. 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.
    24. # 你使用的是透明大页,可能导致redis延迟和内存使用问题。
    25. 临时生效
    26. echo never > /sys/kernel/mm/transparent_hugepage/enabled
    27. 永久生效
    28. vim /etc/rc.local
    29. if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
    30.     echo never > /sys/kernel/mm/transparent_hugepage/enabled
    31. fi
    32. chmod +x /etc/rc.local
    复制代码


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

    1. # /usr/local/redis/bin/redis-server /usr/local/src/redis-5.0.3/redis.conf
    2. 1228:C 24 Jan 2019 23:26:50.044 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    3. 1228:C 24 Jan 2019 23:26:50.044 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=1228, just started
    4. 1228:C 24 Jan 2019 23:26:50.044 # Configuration loaded
    5. 1228:M 24 Jan 2019 23:26:50.044 * Increased maximum number of open files to 10032 (it was originally set to 1024).
    6.                 _._
    7.            _.-``__ ""-._
    8.       _.-``    `.  `_.  ""-._           Redis 5.0.3 (00000000/0) 64 bit
    9.   .-`` .-```.  ```\/    _.,_ ""-._
    10. (    "      ,       .-`  | `,    )     Running in standalone mode
    11. |`-._`-...-` __...-.``-._|"` _.-"|     Port: 6379
    12. |    `-._   `._    /     _.-"    |     PID: 1228
    13.   `-._    `-._  `-./  _.-"    _.-"
    14. |`-._`-._    `-.__.-"    _.-"_.-"|
    15. |    `-._`-._        _.-"_.-"    |           http://redis.io
    16.   `-._    `-._`-.__.-"_.-"    _.-"
    17. |`-._`-._    `-.__.-"    _.-"_.-"|
    18. |    `-._`-._        _.-"_.-"    |
    19.   `-._    `-._`-.__.-"_.-"    _.-"
    20.       `-._    `-.__.-"    _.-"
    21.           `-._        _.-"
    22.               `-.__.-"
    23. 1228:M 24 Jan 2019 23:26:50.045 # Server initialized
    24. 1228:M 24 Jan 2019 23:26:50.045 * DB loaded from disk: 0.000 seconds
    25. 1228:M 24 Jan 2019 23:26:50.045 * Ready to accept connections
    复制代码


    回复

    使用道具 举报

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

    本版积分规则

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

    GMT+8, 2024-5-2 15:07 , Processed in 0.391386 second(s), 37 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc.

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