1

I'm daemonizing celery following the docs.

My BROKER_URL has been set in the following format:- 'amqp://<user>:<password>@<ip>/<vhost>'.

So, when I start celery manually, celery worker -A app_name, it connects with the remote server. But when I daemonize it, it connects with the localhost amqp. Any reason why?

Here is how I create my celery object:-

app = Celery('c26_search')    
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.update(
    CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend'
)
print app.conf.BROKER_URL  # prints remote url

My settings.py file:-

CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
BROKER_URL = `'amqp://<user>:<password>@<ip>/<vhost>'`

Why is it acting so weirdly? Even it prints the remote IP url, but still tries to connects with the local amqp?

Praful Bagai
  • 16,684
  • 50
  • 136
  • 267

1 Answers1

1

Well, I found the answer to the question:-

Pass broker url is CELERY_OPTS as CELERYD_OPTS="-n worker2.%h --broker=amqp://<user>:<password>@<ip>/<vhost>" in celeryd file.

Praful Bagai
  • 16,684
  • 50
  • 136
  • 267