[rabbitmq-discuss] Failure to Connect RabbitMQ/Celery across two EC2 instances

JD jpd750 at gmail.com
Tue Apr 29 23:57:35 BST 2014


>
> I keep getting:`*ERROR/MainProcess] consumer: Cannot connect to 
> amqp://ec2celeryuser*` when I run `celery -A tasks worker` on terminal.
>

Basically what I'm trying to do is get celery/rabbitmq working properly 
across (2) ec2 instances. To pass a silly task in `tasks.py` for processing 
to rabbitmq.

* 1. Instance 1* - Houses rabbitMQ

This currently runs RabbitMQ fine. If I run `sudo rabbitmqctl status` it 
outputs:

    Status of node 'rabbit at ip-xx-xxx-xxx-xx' ...
>     [{pid,786},
>

*2. Instance 2* - Houses Celery

I'm trying to run celery on `instance 2` against Instance 1 using the 
following in terminal:

celery -A tasks worker
>

I have a file `*celeryconfig.py*`:

    BROKER_URL = 
> 'amqp://ec2celeryuser:[email protected]:5672/celeryserver1/'
>     
>     #CELERY SETTINGS
>     CELERY_IMPORTS = ("tasks",)
>     
>     CELERY_RESULT_BACKEND = "amqp"
>

I have a file `*client.py*`:

    from tasks import add
>     
>     result = add.delay(4, 4) # call task
>     result_sum = result.get(timeout=5) # wait to get result for a maximum 
> of 5 seconds
>

I have a file `*tasks.py*`:

    from celery import Celery
>     
>     app = Celery('tasks', 
> broker='amqp://ec2celeryuser:[email protected]:5672/celeryserver1/')
>     
>     @app.task
>     def add(x, y):
>         return x + y
>

I've properly setup a `vhost`, a user `ec2celeryuser`, and gave this user 
permissions of:

    sudo rabbitmqctl set_permissions -p /celeryserver1 ec2celeryuser ".*" 
> ".*" ".*"
>

if I do: `sudo rabbitmqctl list_users` on RabbitMQ (instance 1) it shows:
>

    ec2celeryuser    []
>     guest    [administrator
>

I've tried *both usernames* with their passwords, but no change.

What am I doing wrong here? Clearly there is a connection issue, but what 
am I doing wrong?


*I've been following these without much luck.*
 http://celery.readthedocs.org/en/latest/getting-started/first-steps-with-celery.html
http://www.sammyliu.com/2011/06/23/celery-simple-distributed-tasks-with-celery-and-rabbitmq


Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140429/b983318c/attachment.html>


More information about the rabbitmq-discuss mailing list