WebFaction
Community site: login faq

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:

  1. Installed erlang and RabbitMQ
  2. Created custom port apps for both
  3. Made a symbolic link to the rabbitmq_server-2.5.1/sbin/ in ~/lib/rabbitmq
  4. Installed Celery and djcelery via pip
  5. Added some setting info to my .bash_profile file (see below)
  6. Added celery configuration to my Django settings file (see below)
  7. 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 22 Aug '11, 13:28

tclancy
86515
accept rate: 6%

edited 22 Aug '11, 13:32

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"

(22 Aug '11, 20:33) ryans ♦♦

Not sure I follow: they're set up as custom/ port apps in WebFaction. Everything should be localhost, AFAIK.

(22 Aug '11, 20:43) tclancy

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:

Error: unable to connect to node rabbit@web206: nodedown
nodes and their ports on web206: [{rabbitmqctl28080,44862}]

"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 58896 and telnet localhost 46826, can you confirm that at least the RabbitMQ server is bound there?

(22 Aug '11, 20:49) ryans ♦♦

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

(22 Aug '11, 21:06) tclancy

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.

(22 Aug '11, 21:58) ryans ♦♦

Seems obvious now: I needed to run rabbitmq-server to be able to run rabbitmqctl start_app (that's why it wouldn't respond to a telnet request) and the BROKER_PORT setting should be the rabbitmq app port, not the port I reserved for Celery (why I did that, I don't know).

permanent link

answered 23 Aug '11, 08:00

tclancy
86515
accept rate: 6%

edited 23 Aug '11, 08:01

Crud, still not all the way there. Everything runs, but I get "IOError: Socket closed" when celery tries to talk to rabbit.

(23 Aug '11, 08:41) tclancy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×906
×21
×12
×2

question asked: 22 Aug '11, 13:28

question was seen: 6,051 times

last updated: 23 Aug '11, 08:41

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM