zoukankan      html  css  js  c++  java
  • Redis 服务常见的几个错误解决方案


    问题一 :somaxconn 

    redis启动警告问题: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 512 > /proc/sys/net/core/somaxconn

    长期解决方案

    sudo vim /etc/sysctl.conf
    
    #net.core.somaxconn= 1024 然后执行sysctl -p 就可以永久消除这个warning


    问题二:overcommit_memory

    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


    解决方案

    sudo vim /etc/sysctl.conf
    
    #改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效


    问题三:Transparent Huge Pages

    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修复该问题

    临时解决方法

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

    永久解决方法

    将其写入/etc/rc.local文件中
    
    iftest -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then
        echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
    fi


    问题四:bind: Cannot assign requested address


    发现启动redis启动失败,看redis的日志问题,提示信息如下


    Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address

    解决方案

    将  /etc/redis/redis.conf 文件里面的bind改成
    bind 0.0.0.0

    问题五:MISCONF Redis is configured to save RDB snapshots

    MISCONF Redis is configured to save RDB snapshots, but it is currently 
    not able to persist on disk


    解决方案

    sudo vim /etc/redis/redis.conf
    # 将 stop-writes-on-bgsave-error 接着把后面的yes设置为no即可



    原文地址:Redis 服务常见的几个错误解决方案
    标签:redis   samaxconn   bind   huge   

    智能推荐

  • 相关阅读:
    关于正则表达式的递归匹配问题
    给程序添加启动画面
    C#中的ICollection接口
    C#基本线程同步
    C# 图片裁剪代码
    .NET程序性能的基本要领
    C# 6与VB 12即将加入模式匹配
    Python实例---利用正则实现计算器[FTL版]
    Python实例---利用正则实现计算器[参考版]
    Python学习---重点模块之subprocess
  • 原文地址:https://www.cnblogs.com/apanly/p/12430499.html
Copyright © 2011-2022 走看看