Redis 错误排查

今天redis突然报错,启动不了了记录一下排错过程:

错误1

Connection refused - Unable to connect to Redis on localhost:6379

首先检查redis是否没有启动,通过如下命令即可
# ps aux | grep redis

 

错误2

Short read or OOM loading DB. Unrecoverable error, aborting now.

删除一下redis的db文件和进程文件,然后重启
# rm -rf /var/lib/redis/dump.rdb
# rm -rf /var/run/redis.pid
# service redis-server start

如果之前redis能正常运行,突然某天出问题了,以上2步应该能解决,多半是由于dump.rdb文件出错导致的

 

错误3

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.

照着提示在 /etc/sysctl.conf 增加一行试试
vm.overcommit_memory = 1

 

错误4

Unable to set the max number of files limit to 10032 (Operation not permitted), setting the max clients configuration to 3984.

可以做以下尝试:
在文件增加一行 /etc/sysctl.conf
net.core.somaxconn = 1024

打开文件 /etc/defaults/redis-server,将下面这行去掉注释,如果没有就新增
ULIMIT=65536

打开文件新增以下行 /etc/security/limits.conf
redis soft nofile 65536
redis hard nofile 65536
nginx soft nofile 262144
nginx hard no file 262144

 

参考:

https://community.nodebb.org/topic/1563/redis-advice-on-low-memory-system/7

https://blog.argcv.com/articles/3212.c

https://stackoverflow.com/questions/4670049/rescue-connection-refused-unable-to-connect-to-redis-on-localhost6379

https://stackoverflow.com/questions/19700404/short-read-or-oom-loading-db-unrecoverable-error-aborting-now

转载于:https://my.oschina.net/u/924639/blog/1603478

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值