<div dir="ltr"><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">I keep getting:`<b>ERROR/MainProcess] consumer: Cannot connect to amqp://ec2celeryuser</b>` when I run `celery -A tasks worker` on terminal.<br></blockquote><br>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.<br><br><b> 1. Instance 1</b> - Houses rabbitMQ<br><br>This currently runs RabbitMQ fine. If I run `sudo rabbitmqctl status` it outputs:<br><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">    Status of node 'rabbit@ip-xx-xxx-xxx-xx' ...<br>    [{pid,786},<br></blockquote><br><b>2. Instance 2</b> - Houses Celery<br><br>I'm trying to run celery on `instance 2` against Instance 1 using the following in terminal:<br><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">celery -A tasks worker<br></blockquote><br>I have a file `<b>celeryconfig.py</b>`:<br><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">    BROKER_URL = 'amqp://ec2celeryuser:mypasshere@xx.xxx.xx.xx:5672/celeryserver1/'<br>    <br>    #CELERY SETTINGS<br>    CELERY_IMPORTS = ("tasks",)<br>    <br>    CELERY_RESULT_BACKEND = "amqp"<br></blockquote><br>I have a file `<b>client.py</b>`:<br><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">    from tasks import add<br>    <br>    result = add.delay(4, 4) # call task<br>    result_sum = result.get(timeout=5) # wait to get result for a maximum of 5 seconds<br></blockquote><br>I have a file `<b>tasks.py</b>`:<br><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">    from celery import Celery<br>    <br>    app = Celery('tasks', broker='amqp://ec2celeryuser:mypasshere@xx.xxx.xx.xx:5672/celeryserver1/')<br>    <br>    @app.task<br>    def add(x, y):<br>        return x + y<br></blockquote><br>I've properly setup a `vhost`, a user `ec2celeryuser`, and gave this user permissions of:<br><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">    sudo rabbitmqctl set_permissions -p /celeryserver1 ec2celeryuser ".*" ".*" ".*"<br></blockquote><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">if I do: `sudo rabbitmqctl list_users` on RabbitMQ (instance 1) it shows:<br></blockquote><br><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">    ec2celeryuser    []<br>    guest    [administrator<br></blockquote><br>I've tried <i>both usernames</i> with their passwords, but no change.<br><br>What am I doing wrong here? Clearly there is a connection issue, but what am I doing wrong?<br><br><b>I've been following these without much luck.<br></b> http://celery.readthedocs.org/en/latest/getting-started/first-steps-with-celery.html<br>http://www.sammyliu.com/2011/06/23/celery-simple-distributed-tasks-with-celery-and-rabbitmq<br><br><br>Thank you!<br></div>