V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
miniyao
V2EX  ›  Python

celery 每过一阵子就假死,看日志说是 redis 端口连接不上。然后去看 redis 状态又正常,感觉是 celery 和 redis 互相甩锅

  •  
  •   miniyao · 2019-08-28 12:20:28 +08:00 · 4051 次点击
    这是一个创建于 1674 天前的主题,其中的信息可能已经有所发展或是发生改变。
    没办法,只好重启服务器,celery 和 redis 又都开始正常工作了。

    有什么方式监控吗?否则 celery/redis 什么时候出现故障趴窝了都不清楚
    21 条回复    2019-08-29 10:26:47 +08:00
    julyclyde
        1
    julyclyde  
       2019-08-28 12:23:21 +08:00
    看队列长度就行了
    llen events
    miniyao
        2
    miniyao  
    OP
       2019-08-28 12:37:25 +08:00
    @julyclyde 和 redis 的 connection 都每建立,看不到队列长度了。比较奇怪的是 redis 其实没宕,但是 celery 里的日志说连不上 redis

    redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
    tulongtou
        3
    tulongtou  
       2019-08-28 12:39:43 +08:00 via iPhone
    换 rabbitmq 吧,官方也是推荐 rabbitmq,我用了两年多了,很稳
    julyclyde
        4
    julyclyde  
       2019-08-28 12:41:22 +08:00
    @tulongtou 你这个回答没什么用
    julyclyde
        5
    julyclyde  
       2019-08-28 12:41:55 +08:00
    @miniyao 猜测是 celery 的 fd 耗尽了,无法建立新的连接?
    binjjam
        6
    binjjam  
       2019-08-28 12:57:36 +08:00
    redis timeout 参数是多少?非 0 的话试试改为 0 看
    zuoakang
        7
    zuoakang  
       2019-08-28 13:08:04 +08:00
    celery 什么版本呢? 用了 celery beat 功能吗?
    Ehco1996
        8
    Ehco1996  
       2019-08-28 13:41:39 +08:00
    是不是和 redis 链接的时候没有用连接池?
    链接耗尽了?
    no1xsyzy
        9
    no1xsyzy  
       2019-08-28 15:35:03 +08:00
    @tulongtou 查 celery error 111 都是 rabbitmq 的问答……
    wuwukai007
        10
    wuwukai007  
       2019-08-28 16:00:16 +08:00
    我也遇到过,redis 连接不上,重启就好了
    wuwukai007
        11
    wuwukai007  
       2019-08-28 16:36:47 +08:00
    后来查看 redis 日志,发现 rdb 存储问题,配置一下 redis 后基本就没遇到过这个问题
    miniyao
        12
    miniyao  
    OP
       2019-08-28 19:20:33 +08:00
    @wuwukai007 rdb 存储问题,你配置了 redis 哪几个参数后变得稳定?
    MeteorCat
        13
    MeteorCat  
       2019-08-28 19:39:23 +08:00 via Android
    服务器是不是默认 fd 为 1024
    janus77
        14
    janus77  
       2019-08-28 22:26:43 +08:00
    互相甩锅笑死
    lauix
        15
    lauix  
       2019-08-28 22:38:44 +08:00
    redis 不适合大队列,已经踩过坑了,改成 rabbitmq 稳的很!
    15399905591
        16
    15399905591  
       2019-08-29 08:56:31 +08:00
    我之前也碰到类似问题,是卡在 redis 的阻塞 blpop, 网上查了资料,说是 redis 版本问题,升级了 redis3.2 就完事了
    sazima
        17
    sazima  
       2019-08-29 09:01:20 +08:00
    crontab 每周重启一次 #狗头
    LeeSeoung
        18
    LeeSeoung  
       2019-08-29 09:33:53 +08:00
    出问题的时候先在本机 telnet redis 看是不是真的连不通
    wuwukai007
        19
    wuwukai007  
       2019-08-29 09:51:03 +08:00
    @miniyao # Failed opening .rdb for saving: Read-only file system 之前报的这个错,顺着这个 google 改了配置,改了什么忘了,但是 google 应该有的。
    julyclyde
        20
    julyclyde  
       2019-08-29 10:22:39 +08:00
    @wuwukai007 read-only filesystem 那是你硬盘坏了!!
    wuwukai007
        21
    wuwukai007  
       2019-08-29 10:26:47 +08:00
    @julyclyde 腾讯云服务器上的,硬盘怎么会坏呢?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1246 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:25 · PVG 07:25 · LAX 16:25 · JFK 19:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.