我有一個Django應用程序中,它具有芹菜功能運行芹菜守護進程,這樣我就可以能夠成功地運行芹菜像下面使用監督員不工作
celery -A tasks worker --loglevel=info
但作爲一個衆所周知的事實是,我們需要運行它作爲一個守護進程,所以我寫了/etc/supervisor/conf.d/
文件夾
; ==================================
; celery worker supervisor example
; ==================================
[program:celery]
; Set full path to celery program if using virtualenv
command=/root/Envs/proj/bin/celery -A app.tasks worker --loglevel=info
user=root
environment=C_FORCE_ROOT="yes"
environment=HOME="/root",USER="root"
directory=/root/apps/proj/structure
numprocs=1
stdout_logfile=/var/log/celery/worker.log
stderr_logfile=/var/log/celery/worker.log
autostart=true
autorestart=true
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998
內低於celery.conf
文件,但是當我嘗試更新像supervisorctl reread
和supervisorctl update
監事我是從收到消息
celery FATAL Exited too quickly (process log may have details)
所以我去worker.log
文件,看到錯誤信息如下
Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!
If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).
User information: uid=0 euid=0 gid=0 egid=0
那麼,爲什麼有人抱怨C_FORCE_ROOT
儘管我們已經將它設置爲內部監事的conf文件的環境變量?我在上面的conf文件中做錯了什麼?
不要以root身份運行 - 這不應該是必要的。 (你是否在Django上使用這個功能 - 和那裏的用戶一樣運行。) –
是的,當我刪除行'environment = HOME =「/ root」,USER =「root」時,它工作正常 –
我有這個AWS Elasticbeanstalk存在問題,使用user = ec2-user爲我修復了 –