RabbitMq running on an external server

0

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, the tasks run smoothly, however the application will run via the internet and is installed on an Amazon EC2 instance and the rabbit (for scalability reasons) will be installed on another machine. In the tests done with both in the same instance works perfectly, however when trying to connect to the rabbit in another instance, it does not perform the tasks, however when executing the celery it informs that it is connected and ready. By browsing the RabbitMQ information, via the visual interface plugin, the connections, exchanges and queues generated appear.

What I've done so far

  

I know 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 RabbitMQ visual interface administration plugin.

     

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

If someone can help me with what else is necessary for him to distribute the tasks, be they tutorials, videos or points of documentation that I have not seen or understood.

    
asked by anonymous 26.10.2018 / 16:29

1 answer

0

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

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

When you run rabbitmq and django on the same server, you do not need any additional settings besides those in the tutorials. To accept external connections and not have conflicts, it is mandatory to create user and virtualhost (things I have already done).

But what really solved it was to insert in the file__init__.py from 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. Good luck!

References:
link
link

    
30.10.2018 / 16:48