WebFaction
Community site: login faq

Having some problems getting django to connect to RabbitMQ.

I've pretty much followed this tutorial step by step, and I have supervisor set up to daemonize everything. It all starts up and runs, but celery's log eventually fills up with these:

[2012-02-20 20:54:30,501: INFO/PoolWorker-1] child process calling self.run()
[2012-02-20 20:54:30,502: INFO/PoolWorker-2] child process calling self.run()
[2012-02-20 20:54:30,503: WARNING/MainProcess] celery@web202.webfaction.com has started.
[2012-02-20 20:54:30,504: ERROR/MainProcess] Consumer: Connection Error: [Errno 111] Connection refused. Trying again in 2 seconds...
[2012-02-20 20:54:35,508: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 4 seconds...
[2012-02-20 20:54:42,510: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 6 seconds...

My django settings.py has:

BROKER_HOST = "localhost"
BROKER_PORT = 24400
BROKER_USER = "<user>"
BROKER_PASSWORD = "<password>"
BROKER_VHOST = "<vhost>"
CELERY_RESULT_BACKEND = "amqp"
CELERYD_CONCURRENCY = 2
CELERYD_NODES = "w1"

Supervisor's config file has:

[program:celeryd]
command=/usr/local/bin/python2.6 /home/<user>/webapps/<app>/env/projectroot/manage.py celeryd --logfile=/home/<user>/webapps/<app>/env/logs/celeryd-log.log --loglevel=info
environment=LD_LIBRARY_PATH=/home/<user>/webapps/<app>/env/lib,PYTHONPATH=/home/<user>/webapps/<app>/env/lib/python2.6/site-packages
stdout_logfile=/home/<user>/webapps/<app>/env/logs/celeryd-log.log
stderr_logfile=/home/<user>/webapps/<app>/env/logs/celeryd-error.log

[program:rabbitmq]
command=/home/<user>/rabbitmq/sbin/rabbitmq-server
stdout_logfile=/home/<user>/logs/user/log_rabbitmq.log
stderr_logfile=/home/<user>/logs/user/error_rabbitmq.log

I can user rabbitmqctl to interact with rabbitmq-server just fine. Not sure how else I can diagnose the problem. I'm about to try recompiling rabbitmq and trying to set the various environment variables through the supervisor config file instead of how the tutorial above outlines doing it. But I feel like rabbitmq is running just fine.

asked 20 Feb '12, 21:13

pixeldonor
111
accept rate: 0%


Hello,

Have you seen this related post. It has some information on issues with the hostname, this may be causing your connection issue.

permanent link

answered 20 Feb '12, 23:25

johns
5.3k312
accept rate: 23%

johns - checked out the above, not really giving me any fresh ideas.

also here's the rabbitmq process if that helps:

/home/<user>/erlang/lib/erlang/erts-5.8.4/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /home/<user>/erlang/lib/erlang -progname erl -- -home /home/<user> -epmd_port 23171 -- -noshell -noinput -sname rabbit@web202 -boot /home/<user>/rabbitmq/sbin/rabbit@web202-plugins-expand/rabbit -kernel inet_default_connect_options [{nodelay,true}] -rabbit tcp_listeners [{"auto",24400}] -sasl errlog_type error -sasl sasl_error_logger false -rabbit error_logger {file,"/home/<user>/logs/user/rabbitmq/rabbit@web202.log"} -rabbit sasl_error_logger {file,"/home/<user>/logs/user/rabbitmq/rabbit@web202-sasl.log"} -os_mon start_cpu_sup true -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/home/<user>/rabbitmq/sbin/rabbit@web202"

the epmd_port (23171) and rabbitmq port (24400) both correspond to whats given in the control panel for my custom apps listening on port.

(21 Feb '12, 08:49) pixeldonor

Problem solved!

Still not 100% sure what the problem was... rabbitmq would run just fine initially, but I could never connect to it. So instead of compiling rabbitmq from source, I tried the pre-compiled version for generic unix and it worked just fine this time around.

That in mind, if you follow the tutorial in my initial post you shouldn't have any problems.

permanent link

answered 21 Feb '12, 22:01

pixeldonor
111
accept rate: 0%

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:

×909
×337
×21
×12

question asked: 20 Feb '12, 21:13

question was seen: 9,349 times

last updated: 21 Feb '12, 22:01

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