I'm trying to get a Django Celery worker to connect to a RabbitMQ server, all running on the same host.
However, when I run manage.py celery worker
all I get is:
[2013-06-11 17:33:41,185: WARNING/MainProcess] celery@localhost has started.
[2013-06-11 17:33:44,192: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 2 seconds...
[2013-06-11 17:33:50,203: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 4 seconds...
[2013-06-11 17:34:03,214: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 6 seconds...
[2013-06-11 17:34:27,232: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 8 seconds...
When I inspect my /var/log/rabbitmq/[email protected]
I see several messages like:
=ERROR REPORT==== 11-Jun-2013::17:33:44 ===
exception on TCP connection <0.201.0> from 127.0.0.1:43461
{channel0_error,opening,
{amqp_error,access_refused,
"access to vhost 'myapp' refused for user 'guest'",
'connection.open'}}
I'm using the standard package out of Ubuntu 12.04's repo, with the default settings and my django-celery settings look like:
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "myapp"
Why is RabbitMQ refusing connections?
In order for a client to interact with RabbitMQ it must first open a connection. This process involves a number of steps: Application configures the client library it uses to use a certain connection endpoint (e.g. hostname and port) The library resolves the hostname to one or more IP addresses.
blocked notification is sent to publishing connections the first time RabbitMQ is low on a resource. For example, when a RabbitMQ node detects that it is low on RAM, it sends connection. blocked to all connected publishing clients supporting this feature.
To connect to RabbitMQ from a different machine, you must open ports 5672 and 5672 for remote access. Refer to the FAQ for more information on this. IMPORTANT: Making this application's network ports public is a significant security risk.
Create new RabbitMQ user and set permissions To create a new RabbitMQ user to access the RabbitMQ server remotely: Open a browser and navigate to http://localhost:15672/. The RabbitMQ Management login screen displays. Log into RabbitMQ using guest as both the username and password.
It looks like you need to grant access to the "/myapp" vhost for the "guest" user.
From the docs:
set_permissions [-p vhostpath] {user} {conf} {write} {read}
So something similar to this will give your guest user unlimited access:
rabbitmqctl set_permissions -p /myvhost guest ".*" ".*" ".*"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With