Following the instructions in this thread, I've managed to get RabbitMQ partially up and running (for the user account groundenergy), but I cannot connect to it via Celery through my Django application. Here's what I've done/ where I am at:
- Installed erlang and RabbitMQ
- Created custom port apps for both
- Made a symbolic link to the rabbitmq_server-2.5.1/sbin/ in ~/lib/rabbitmq
- Installed Celery and djcelery via pip
- Added some setting info to my .bash_profile file (see below)
- Added celery configuration to my Django settings file (see below)
- Tried running my task code (which works locally), but I get a
socket.error: [Errno 111] Connection refused
I don't think RabbitMQ is quite perfectly installed. I can run rabbitmq-server and see it in netstat on the proper port (because I have set the port in my environment variables), but rabbitmqctl start_app fails with:
| Starting node rabbit@web206 ...
Error: unable to connect to node rabbit@web206: nodedown
diagnostics:
- nodes and their ports on web206: [{rabbitmqctl28080,44862}]
- current node: rabbitmqctl28080@web206
|
Any idea why Django can't connect to Rabbit? Based on this link, I'm not sure Rabbit is listening on the right port. I'm not 100% clear on how to configure that, since 95Rabbit's documentation95 says you can only use a file under /etc to configure it, which we don't have access to on WebFaction.
.bash_profile
| export ERL_EPMD_PORT=58896
export RABBITMQ_NODE_PORT=46826
export ERL_INETRC=/home/groundenergy/.erl_inetrc
|
Django settings.py
| BROKER_HOST = "localhost"
BROKER_PORT = 40966
BROKER_USER = "groundenergy"
BROKER_PASSWORD = "mypassword"
BROKER_VHOST = "/"
CELERY_RESULT_BACKEND = 'amqp'
CELERY_STORE_ERRORS_EVEN_IF_IGNORED = True
CELERYD_NODES="w1 w2"
|
asked
Aug 22 '11 at 13:28
tclancy
64●7
Which IP address are these ports bound to? When a program binds to a port, it also specifies an IP address. For example, "port 12345 on localhost" is different from "port 12345 on web206.webfaction.com"
Not sure I follow: they're set up as custom/ port apps in WebFaction. Everything should be localhost, AFAIK.
Right; it's just that this line seems to suggest they might be either binding to web206 (the external IP), or else attempting to be accessed on the external IP, instead:
"web206" is an alias for "web206.webfaction.com". It feels like you're binding to localhost, but the rabbitMQ instance is attempting to connect onto the external IP. (They should both be using localhost.)
If you
telnet localhost 58896andtelnet localhost 46826, can you confirm that at least the RabbitMQ server is bound there?The first one responds, the second one does not. Wondering how I managed to bind to the external IP based on the instructions at http://community.webfaction.com/questions/2366/can-i-use-rabbit-mq-on-the-shared-servers
We haven't written those instructions, so we can't vouch for them. That said, the important thing is to ensure that your applications are both listening on, and connecting to, those ports on
localhost. If time permits, I'll try to get an entire Django+Celery+RabbitMQ stack up and running, posting the full install guide.