使用者:无法连接到 amqp://dfmngfek:**@salamander.rmq.cloudamqp.com:56



我的网站运行基于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:[错误 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'),
},
}

自动完成/任务.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... 

任何帮助都会非常有用!

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

相关内容

  • 没有找到相关文章