python redis 连接超时,可能是什么原因了? - 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
larkifly

python redis 连接超时,可能是什么原因了?

  •  
  •   larkifly Feb 4, 2016 5956 views
    This topic created in 3774 days ago, the information mentioned may be changed or developed.
    redis 的日志级别是 notice ,查看 timeout 是, redis 日志没有更新,依然是启动时的日志。

    重启 python 程序,又能连上了,中间 redis 没有做任何改动或者重启。

    redis 和 python 程序在一个内网,不同机器。
    6 replies    2016-02-04 15:37:17 +08:00
    aisk
        1
    aisk  
       Feb 4, 2016
    redis 当时是不是 CPU 跑满了?
    thinsky
        2
    thinsky  
       Feb 4, 2016
    可能是连接数达到上限?
    iyaozhen
        3
    iyaozhen  
       Feb 4, 2016
    应该是 redis 主动断掉了不活跃的连接。不知到你是连上 redis 进行什么操作,如果是 pub/sub 则需要在客户端连接时设置一个类似 read_timeout=-1 的东西。 PHP 的还需这样: ini_set(‘ default_socket_timeout ’, -1)。不过一般的话设置 redis timeout=0 就行了。
    mckelvin
        4
    mckelvin  
       Feb 4, 2016
    Redis 的原因,或者 Redis 到 Python 程序中间的网络原因(比如网络延迟)。

    Python 程序用的 Redis 客户端去兼容下断线重连比较好?

    另外建议给机器和 Redis 集群都加上系统指标方便查问题,比如 Redis 所在机器的 CPU, 网络, Redis 本地时延,远程时延。
    larkifly
        5
    larkifly  
    OP
       Feb 4, 2016
    @aisk cpu 内存 硬盘状态都是正常的
    larkifly
        6
    larkifly  
    OP
       Feb 4, 2016
    @iyaozhen timeout=0 这个已经设置了
    About     Help     Advertise     Blog     API     FAQ     Solana     927 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 34ms UTC 19:40 PVG 03:40 LAX 12:40 JFK 15:40
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86