0x01 Use Guide of Celery Daemon
In production environment I need celery runing as daemon process. According to the official document,there are several ways to use, such as generic init scripts,systemd,supervisord and so on.
0x02 Use init script
We can get the script from extra/generic-init.d. You need add the file to /etc/init/ named as celeryd. Besides you need motified the configure file /etc/default/celeryd. To configure this script to run the worker properly you probaly need to at last tell it where to change dierctory when ti starts.
This is an expample configration for a Python project.
1 | # Names of nodes to start |
Then this is my configration for my project:1
2
3
4
5
6
7
8
9CELERYD_NODES="worker1"
CELERY_BIN="/usr/local/bin/celery"
CELERYD_CHDIR="/root/Documents/WebEye"
CELERYD_OPTS="--config=confs.worker.workerceleryconf --time-limit=300 --concurrency=8"
CELERYD_LOG_FILE="/var/log/celery/%N.log"
CELERYD_PID_FILE="/var/run/celery/%N.pid"
CELERYD_USER="root"
CELERYD_GROUP="root"
CELERY_CREATE_DIRS=1
Then you could use service celeryd {start|stop|restart|status} to get your information
0x03 Thanks
在此我要感谢诸位陈老师给我悉心的帮助和对我耐心而细致的指导。他们在我工作中给了我许多宝贵的意见和建议。同时也要感谢自己遇到困难的时候没有一蹶不振,取而代之的是找到了最好的方法来解决问题。最后,感谢生我养我的父母。谢谢他们给了我无私的爱,为我人生道路付出的巨大牺牲和努力。