Rabbitmq running on an external server

Asked

Viewed 124 times

1

I have a Django web application that uses Celery for asynchronous tasks and Rabbitmq for Broker management. When both are running on the same machine, tasks are performed smoothly, but the application will run over the internet and is installed in an Amazon EC2 instance and Rabbit (for scalability reasons) will be installed on another machine. In tests performed with both in the same instance works perfectly, but when trying to connect to Rabbit in another instance, it does not perform the tasks, but when running Celery it informs that it is connected and ready. Consulting the information Rabbitmq, via visual interface plugin, appear the connections, Exchanges and queues generated.

What I’ve done so far

I know that Rabbitmq does not use the guest user for external connections, so I created a user for the connection, and I set the [Administrator] tag to access the visual interface administration plugin of Rabbitmq.

In the AWS settings, I created a security group and opened ports 5672, 15672(for the plugin) and 55672.

If anyone can help me with what else is needed for him to distribute the tasks, be it tutorials, videos or documentation points that I haven’t seen or understood.

  • I received a negative vote, I would like to know why, so that I can correct in a next question.

1 answer

1


I managed to solve the problem and resolved to answer my own question to those who eventually fall here through a "googlada".

The problem was not with the rabbitMQ settings, but with the Celery in the code.

When running rabbitmq and Django on the same server, no additional settings are required, other than those of the tutorials. To accept external connections and have no conflicts, it is mandatory to create user and virtualhost (things I had already done).

But what really solved was to insert in the arquivo__init__.py of the same folder where the Celery.py file is located the following code:

from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app

__all__ = ('celery_app',)

With that, problem solved for me.

References:
https://stackoverflow.com/questions/53066316/celery-not-queuing-to-a-remote-broker-adding-tasks-to-a-localhost-instead
https://stackoverflow.com/questions/42860356/celery-not-queuing-tasks-to-broker-on-remote-server-adds-tasks-to-localhost-ins

Browser other questions tagged

You are not signed in. Login or sign up in order to post.