Kofi John
Kofi John

Reputation: 133

celery can't connect to rabbitmq - unexpected method received

I'm trying to get my celery daemon running on an Ubuntu box on rackspace but I'm having trouble connecting celery with rabbitmq. On my mac, everything works fine using the default rabbitmq settings ( BROKER_URL = 'amqp://') but on the production server, I can't get celery to talk to rabbitmq.

Here's what i did:

$ sudo rabbitmqctl add_user celeryuser celerypassword
$ sudo rabbitmqctl add_vhost celeryhost
$ sudo rabbitmqctl set_permissions -p celeryhost celeryuser ".*" ".*" ".*"

following directions from here

in celeryconfig.py I defined the broker url with the configurations from above

BROKER_URL = 'amqp://celeryuser:celerypassword@localhost:5672/celeryhost'

and in celery_app.py I load the above configurations with:

app.config_from_object('proj.celeryconfig')

However when i try to start the celery worker with:

celery worker --app=proj.celery_app

I get the following error:

-------------- celery@app1 v3.1.13 (Cipater)
---- **** ----- 
--- * ***  * -- Linux-2.6.32-64-server-x86_64-with-Ubuntu-10.04-lucid
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         proj:0x29e9850
- ** ---------- .> transport:   amqp://celeryuser:**@localhost:5672/celeryhost
- ** ---------- .> results:     amqp
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- 
--- ***** ----- [queues]
-------------- .> celery           exchange=celery(direct) key=celery


[2014-09-12 09:28:00,266: ERROR/MainProcess] consumer: Cannot connect to amqp://celeryuser:**@localhost:5672/celeryhost: Couldn't log in: unexpected method received.
Trying again in 2.00 seconds...

I checked to see if rabbitmq server is running with:

$ sudo rabbitmqctl status

and the result was:

Status of node rabbit@app1 ...
[{running_applications,[{rabbit,"RabbitMQ","1.7.2"},
                        {mnesia,"MNESIA  CXC 138 12","4.4.12"},
                        {os_mon,"CPO  CXC 138 46","2.2.4"},
                        {sasl,"SASL  CXC 138 11","2.1.8"},
                        {stdlib,"ERTS  CXC 138 10","1.16.4"},
                        {kernel,"ERTS  CXC 138 10","2.13.4"}]},
 {nodes,[rabbit@app1]},
 {running_nodes,[rabbit@app1]}]
...done.

Upvotes: 3

Views: 1650

Answers (1)

Kofi John
Kofi John

Reputation: 133

This was happening because the ubuntu server had a much older version of rabbitmq installed then i had on my development machine.

As I realized when i looked at the status of the rabbitmq worker.. the version stated:

{rabbit,"RabbitMQ","1.7.2"},

but on my local i had

{rabbit,"RabbitMQ","3.3.4"},

I updated the version of the rabbitmq server on ubuntu and set the same permissions as above, using this post as a guide

Now I am able to successfully start the celery worker on the production machine.

Upvotes: 2

Related Questions