zoukankan      html  css  js  c++  java
  • redis celery too many connection

    用django 框架,异步任务用celery,队列用redis

    出现了这个问题,too many connection

     Couldn't ack '5f41afc62d-a112-bef34d5de1cc', reason:ConnectionError('Too many connections',)

    Traceback (most recent call last):
      File "/srv/www/wom/env/lib/python2.6/site-packages/kombu/message.py", line 93, in ack_log_error
        self.ack()
      File "/srv/www/wom/env/lib/python2.6/site-packages/kombu/message.py", line 88, in ack
        self.channel.basic_ack(self.delivery_tag)
      File "/srv/www/wom/env/lib/python2.6/site-packages/kombu/transport/virtual/__init__.py", line 566, in basic_ack
        self.qos.ack(delivery_tag)
      File "/srv/www/wom/env/lib/python2.6/site-packages/kombu/transport/redis.py", line 152, in ack
        self._remove_from_indices(delivery_tag).execute()
      File "/srv/www/wom/env/lib/python2.6/site-packages/redis/client.py", line 1914, in execute
        self.shard_hint)
      File "/srv/www/wom/env/lib/python2.6/site-packages/redis/connection.py", line 395, in get_connection
        connection = self.make_connection()
      File "/srv/www/wom/env/lib/python2.6/site-packages/redis/connection.py", line 402, in make_connection
        raise ConnectionError("Too many connections")
    ConnectionError: Too many connections
     
     
    看了文档之后,要设个变量

    BROKER_POOL_LIMIT

    New in version 2.3.

    The maximum number of connections that can be open in the connection pool.

    The pool is enabled by default since version 2.5, with a default limit of ten connections. This number can be tweaked depending on the number of threads/greenthreads (eventlet/gevent) using a connection. For example running eventlet with 1000 greenlets that use a connection to the broker, contention can arise and you should consider increasing the limit.

    If set to None or 0 the connection pool will be disabled and connections will be established and closed for every use.

    Default (since 2.5) is to use a pool of 10 connections.
     

    CELERY_REDIS_MAX_CONNECTIONS

    Maximum number of connections available in the Redis connection pool used for sending and retrieving results.
     
     

    BROKER_TRANSPORT_OPTIONS

    New in version 2.2.

    A dict of additional options passed to the underlying transport.

    See your transport user manual for supported options (if any).

    Example setting the visibility timeout (supported by Redis and SQS transports):

    BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 18000}  # 5 hours

    
    
    要设置 max_connections 才能解决下面的问题 
  • 相关阅读:
    chkdsk磁盘修复命令工具怎么用,怎样运行chkdsk工具修复?
    phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接。您应该检查配置文件中的主机、用户名和密码
    APiCloud真机调试需要注意的几个问题
    QQ个人文件夹中的文件被占用,解决办法
    PHPExcel读取excel文件
    数据挖掘与机器学习
    什么是数据挖掘?
    数据挖掘相关的10个问题
    PhpStorm 快捷键大全 PhpStorm 常用快捷键和配置
    VirtualBox提示:错误,创建一个新任务失败,被召者解决办法
  • 原文地址:https://www.cnblogs.com/yemsheng/p/4172886.html
Copyright © 2011-2022 走看看