I am trying to use Celery in my Beanstalk environment (this is the last part to complete the technological stack of my project: P). This is what I have done so far:
- Since RabbitMQ is the best broker for Celery, and Amazon does not provide a dedicated service, I created a custom AMI based on Ubuntu 13 64bit.
- installed RabbitMQ
- remote user / user by default user
- created by user user
- created a user virtual host
- Installed Admin Plugins
- checked my configuration using the http API to confirm that my RabbitMQ server is up and running.
So far so good! Then in the beanstalk .config file I added a couple of commands for celery:
04_celery_periodic_tasks:
command: "celery worker --app=com.cygora --loglevel=info --beat --autoreload -n period_tasks_worker.%h"
leader_only: true
05_celery_standard_worker:
command: "celery worker --app=com.cygora --loglevel=info --autoreload -n worker_1.%h"
As soon as I deployed my application, I did not find an error related to celery (so I assume that everything is fine, from the “Python / Django side”) ... but as soon as I use the function my site, which requires sending a message to Rabbit through celery, I get a timeout exception:
[Thu Feb 20 22:01:24 2014] [error] File "/opt/python/run/venv/lib/python2.7/site-packages/kombu/transport/pyamqp.py", line 111, in establish_connection
[Thu Feb 20 22:01:24 2014] [error] conn = self.Connection(**opts)
[Thu Feb 20 22:01:24 2014] [error] File "/opt/python/run/venv/lib/python2.7/site-packages/amqp/connection.py", line 165, in __init__
[Thu Feb 20 22:01:24 2014] [error] self.transport = create_transport(host, connect_timeout, ssl)
[Thu Feb 20 22:01:24 2014] [error] File "/opt/python/run/venv/lib/python2.7/site-packages/amqp/transport.py", line 274, in create_transport
[Thu Feb 20 22:01:24 2014] [error] return TCPTransport(host, connect_timeout)
[Thu Feb 20 22:01:24 2014] [error] File "/opt/python/run/venv/lib/python2.7/site-packages/amqp/transport.py", line 89, in __init__
[Thu Feb 20 22:01:24 2014] [error] raise socket.error(last_err)
[Thu Feb 20 22:01:24 2014] [error] error: timed out
I specified the broker's URL in the settings as:
BROKER_URL = "amqp://myuser:mypassword@myelasticip:5672/myvirtualhost"
What am I missing or what have I done wrong? Why cannot a socket connection be established?
source
share