【问题标题】:consumer: Cannot connect to amqp://dfmngfek:**@salamander.rmq.cloudamqp.com:5672/dfmngfek: [Errno 104] Connection reset by peer消费者:无法连接到 amqp://dfmngfek:**@salamander.rmq.cloudamqp.com:5672/dfmngfek:[Errno 104] 连接被对等方重置
【发布时间】:2020-01-29 01:25:04
【问题描述】:

我的网站使用基于 RabbitMQ 的 Python 3.5.6、Django 1.11.20、Celery 4.3.0、CloudAMQP(通过 Heroku)运行。将应用部署到 Heroku 时,Celery 返回以下错误:

消费者:无法连接到 amqp://dfmngfek:*@salamander.rmq.cloudamqp.com:5672/dfmngfek:[Errno 104] 对等方重置连接

我找不到这个问题是从哪里来的。

这是我的设置:

CELERY_BROKER_POOL_LIMIT = 1
CELERY_BROKER_CONNECTION_MAX_RETRIES = 100

settings_remote.py:

CELERY_BROKER_URL = os.environ['CLOUDAMQP_URL']

__ init.py __ :

from .celery_tasks import app as celery_app
__all__ = ['celery_app']

celery_tasks.py:

import os
from celery import Celery
from celery.schedules import crontab
from datetime import datetime, timedelta
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'terradiem.settings')
from django.conf import settings
app = Celery('terradiem')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

app.conf.CELERYBEAT_SCHEDULE = \
    {
        'updateavcontribrating_task':
            {
                'task': 'gautocomplete.tasks.updateavplacecontribratingregular',
                'schedule': crontab(0, 0, day_of_month='2'),

            },
     }

gautocomplete/tasks.py :

@app.task(bind=True)
def updateavplacecontribratingregular(self):
    Etc...

错误信息:

Sep 29 16:15:25 terradiem app/beat.1:  -------------- celery@6e5f2660-eba2-4db3-9aba-5ac2b9547b70 v4.3.0 (rhubarb) 
Sep 29 16:15:25 terradiem app/beat.1: ---- **** -----  
Sep 29 16:15:25 terradiem app/beat.1: --- * ***  * -- Linux-4.4.0-1054-aws-x86_64-with-debian-buster-sid 2019-09-29 16:15:24 
Sep 29 16:15:25 terradiem app/beat.1: -- * - **** ---  
Sep 29 16:15:25 terradiem app/beat.1: - ** ---------- [config] 
Sep 29 16:15:25 terradiem app/beat.1: - ** ---------- .> app:         terradiem:0x7f56212a8550 
Sep 29 16:15:25 terradiem app/beat.1: - ** ---------- .> transport:   amqp://dfmngfek:**@salamander.rmq.cloudamqp.com:5672/dfmngfek 
Sep 29 16:15:25 terradiem app/beat.1: - ** ---------- .> results:     disabled:// 
Sep 29 16:15:25 terradiem app/beat.1: - *** --- * --- .> concurrency: 8 (prefork) 
Sep 29 16:15:25 terradiem app/beat.1: -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker) 
Sep 29 16:15:25 terradiem app/beat.1: --- ***** -----  
Sep 29 16:15:25 terradiem app/beat.1:  -------------- [queues] 
Sep 29 16:15:25 terradiem app/beat.1:                 .> celery           exchange=celery(direct) key=celery 
Sep 29 16:15:25 terradiem app/beat.1:                  
Sep 29 16:15:25 terradiem app/beat.1:  
Sep 29 16:15:25 terradiem app/beat.1: [tasks] 
Sep 29 16:15:25 terradiem app/beat.1:   . gautocomplete.tasks.updateavplacecontribratingregular 
Sep 29 16:15:25 terradiem app/beat.1:  
Sep 29 16:15:26 terradiem app/web.1: DEBUG 2019-09-29 16:15:25,821 base 12 139757909414400 Configuring Raven for host: https://sentry.io 
Sep 29 16:15:26 terradiem app/beat.1: [2019-09-29 16:15:26,075: INFO/Beat] beat: Starting... 
Sep 29 16:15:29 terradiem app/beat.1: [2019-09-29 16:15:29,041: ERROR/MainProcess] consumer: Cannot connect to amqp://dfmngfek:**@salamander.rmq.cloudamqp.com:5672/dfmngfek: [Errno 104] Connection reset by peer. 
Sep 29 16:15:29 terradiem app/beat.1: Trying again in 2.00 seconds... 

任何帮助都会非常有用!

【问题讨论】:

标签: python django rabbitmq celery cloudamqp


【解决方案1】:

已超出 CloudAMPQ 的使用限制。我选择了更大的计划,错误不再出现。

【讨论】:

    猜你喜欢
    • 2017-11-26
    • 2020-03-12
    • 2016-10-10
    • 2014-01-04
    • 1970-01-01
    • 2018-10-24
    • 2023-01-10
    • 1970-01-01
    相关资源
    最近更新 更多