redis celery too many connection

來源:互聯網
上載者:User

標籤:blog   http   ar   io   os   sp   for   on   div   

用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_CONNECTIONSMaximum 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 才能解決下面的問題 

redis celery too many connection

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.