이콜레모 개발자 위키

celery


Youngrok Pak at 10 years, 6 months ago.

파이썬으로 개발된 TaskQueue 서버. 보통 rabbitmq를 백엔드로 쓰며, Django랑 쉽게 연동할 수 있다. 하지만 django-celery가 주는 이득은 그냥 초기화를 쉽게 해준다는 정도.

우분투 설정

/etc/init/celery.conf

description "django-celery worker for newsqu"
author "youngrok - http://ecolemo.com"

# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown

# Automatically Respawn:
respawn
respawn limit 99 5

script
cd /path/to/project
exec sudo -uubuntu celery worker -E -l INFO --concurrency 2 --logfile=/path/to/celery.log
end script

post-start script
# Optionally put a script here that will notifiy you node has (re)started
# /root/bin/hoptoad.sh "node.js has started!"
end script

그러면 다음 명령으로 시작이 가능하다.

sudo start celery

--concurrency가 중요한 옵션. 프로세스가 몇 개 떠 있을지를 결정한다.

모니터링

여러 도구가 있지만 flower가 가장 강력하다. celery와 비슷하게 설정하며 실행 명령만 다음과 같이 바꾸면 된다.

celery flower --broker_api=http://guest:guest@localhost:15672/api/

--broker_api 설정이 맞아야 브로커 모니터링이 가능하다. 물론 설치는 따로 해야 한다.


Comments


크리에이티브 커먼즈 라이선스
이 저작물은 크리에이티브 커먼즈 저작자표시 3.0 Unported 라이선스에 따라 이용할 수 있습니다.


Wiki at WikiNamu