2013-04-14 16 views
6

Po uruchomieniu komendy celery status na moim serwerze produkcyjnym otrzymuję ten błąd:Django Seler socket.error: [errno 111] Połączenie odrzucone

Ale prace selera i pracownik nie działają, co to jest błąd i dlaczego Nie uruchamiam tego polecenia?

[email protected]:/srv/project/logs/celery$ celery status 
Traceback (most recent call last): 
    File "/usr/local/bin/celery", line 9, in <module> 
    load_entry_point('celery==3.0.11', 'console_scripts', 'celery')() 
    File "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 14, in main 
    main() 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 946, in main 
    cmd.execute_from_commandline(argv) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 890, in execute_from_commandline 
    super(CeleryCommand, self).execute_from_commandline(argv))) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 179, in execute_from_commandline 
    return self.handle_argv(prog_name, argv[1:]) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 882, in handle_argv 
    return self.execute(command, argv) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 857, in execute 
    return cls(app=self.app).run_from_argv(self.prog_name, argv) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 142, in run_from_argv 
    return self(*args, **options) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 112, in __call__ 
    ret = self.run(*args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 652, in run 
    .run('ping', **dict(kwargs, quiet=True, show_body=False)) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 505, in run 
    return self.do_call_method(args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 527, in do_call_method 
    replies = handler(method, *args[1:], **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 570, in call 
    return getattr(i, method)(*args) 
    File "/usr/local/lib/python2.7/dist-packages/celery/app/control.py", line 79, in ping 
    return self._request('ping') 
    File "/usr/local/lib/python2.7/dist-packages/celery/app/control.py", line 54, in _request 
    timeout=self.timeout, reply=True)) 
    File "/usr/local/lib/python2.7/dist-packages/celery/app/control.py", line 260, in broadcast 
    channel=channel) 
    File "/usr/local/lib/python2.7/dist-packages/kombu/pidbox.py", line 235, in _broadcast 
    chan = channel or self.connection.default_channel 
    File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 748, in default_channel 
    self.connection 
    File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 733, in connection 
    self._connection = self._establish_connection() 
    File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 692, in _establish_connection 
    conn = self.transport.establish_connection() 
    File "/usr/local/lib/python2.7/dist-packages/kombu/transport/pyamqp.py", line 109, in establish_connection 
    heartbeat=conninfo.heartbeat) 
    File "/usr/local/lib/python2.7/dist-packages/amqp/connection.py", line 136, in __init__ 
    self.transport = create_transport(host, connect_timeout, ssl) 
    File "/usr/local/lib/python2.7/dist-packages/amqp/transport.py", line 250, in create_transport 
    return TCPTransport(host, connect_timeout) 
    File "/usr/local/lib/python2.7/dist-packages/amqp/transport.py", line 95, in __init__ 
    raise socket.error, msg 
socket.error: [Errno 111] Connection refused 

Ustawienia ...

CELERYD_NODES="w1 w2 w3" 

# Where to chdir at start. 
CELERYD_CHDIR="/srv/project/" 

# How to call "manage.py celeryd_multi" 
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi" 

# How to call "manage.py celeryctl" 
CELERYCTL="$CELERYD_CHDIR/manage.py celeryctl" 

# Extra arguments to celeryd 
CELERYD_OPTS="--time-limit=300 --concurrency=8" 

# %n will be replaced with the nodename. 
CELERYD_LOG_FILE="/srv/project/logs/celery/%n.log" 
CELERYD_PID_FILE="/srv/project/celery/%n.pid" 

# Workers should run as an unprivileged user. 
CELERYD_USER="ubuntu" 
CELERYD_GROUP="ubuntu" 

# Name of the projects settings module. 
export DJANGO_SETTINGS_MODULE="project.settings" 
+0

Czy możesz przesłać trochę konfiguracji? –

+0

zaktualizowano zobacz pytanie :) – Prometheus

+0

który broker wybrałeś? –

Odpowiedz

14

Uruchom z manage.py Shell ...

sudo python manage.py celery status 

to rozwiąże problem.

+2

Dlaczego sudo ?, zadziałało, ale nie zrobiłem sudo – chachan

+1

@chachan sudo jest po prostu dla wzniosłego przywileje. Jeśli go nie potrzebujesz, to robisz coś dobrze! –

+0

To nadal daje "[Errno 111] Połączenie odrzucone" –

3

W moim przypadku musiałem dodać następujące linie w pliku __init__.py w opakowaniu zawierającym settings.py i celery.py pliki:

# -*- coding: utf-8 -*- 
from __future__ import absolute_import 

# This will make sure the app is always imported when 
# Django starts so that shared_task will use this app. 
from .celery import app as celery_app 

Sprawdź http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html celach informacyjnych.