Amazon-SQS + Django-Celery创建了数千个队列(每个消息都有一个队列)

时间:2022-02-11 17:38:13

I am looking for a place to start troubleshooting this problem.

我正在寻找一个地方开始解决这个问题。

here are the changes made in the settings.py

以下是settings.py中所做的更改

#Rabbit MQ settings
#===============================================================================
# BROKER_HOST = "localhost"
# BROKER_PORT = 5672
# BROKER_USER = "vei_0"
# BROKER_PASSWORD = "1234"
# BROKER_VHOST = "videoencoder"
#===============================================================================




DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = "xxxx"
AWS_SECRET_ACCESS_KEY = "xxxx"
AWS_STORAGE_BUCKET_NAME = "images"
#Amazon SQS settings.
BROKER_TRANSPORT = 'sqs'
BROKER_TRANSPORT_OPTIONS = {
    'region': 'us-east-1',
}
BROKER_USER = AWS_ACCESS_KEY_ID
BROKER_PASSWORD = AWS_SECRET_ACCESS_KEY
CELERY_DEFAULT_QUEUE = 'hardwaretaskqueue'
CELERY_QUEUES = {
    CELERY_DEFAULT_QUEUE: {
        'exchange': CELERY_DEFAULT_QUEUE,
        'binding_key': CELERY_DEFAULT_QUEUE,
    }
}


CELERYD_CONCURRENCY = 2
CELERY_TASK_RESULT_EXPIRES = 120
CELERY_RESULT_BACKEND = "amqp"

I woke up this morning to a message from amazon saying "Did you mean to make a bijillion queues?"

今天早上我醒来时发来一条来自亚马逊的消息说:“你的意思是要制造一个数十亿的队列吗?”

1 个解决方案

#1


9  

When using the CELERY_RESULT_BACKEND = 'amqp' a new queue is created for each result message. To avoid this you can simply use another CELERY_RESULT_BACKEND such as a database or Redis. Or if you aren't interested in the results then you can set CELERY_IGNORE_RESULT = True.

使用CELERY_RESULT_BACKEND ='amqp'时,会为每个结果消息创建一个新队列。为避免这种情况,您只需使用另一个CELERY_RESULT_BACKEND,例如数据库或Redis。或者,如果您对结果不感兴趣,则可以设置CELERY_IGNORE_RESULT = True。

#1


9  

When using the CELERY_RESULT_BACKEND = 'amqp' a new queue is created for each result message. To avoid this you can simply use another CELERY_RESULT_BACKEND such as a database or Redis. Or if you aren't interested in the results then you can set CELERY_IGNORE_RESULT = True.

使用CELERY_RESULT_BACKEND ='amqp'时,会为每个结果消息创建一个新队列。为避免这种情况,您只需使用另一个CELERY_RESULT_BACKEND,例如数据库或Redis。或者,如果您对结果不感兴趣,则可以设置CELERY_IGNORE_RESULT = True。