Pythonsupervisor安装和管理celery
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Pythonsupervisor安装和管理celery相关的知识,希望对你有一定的参考价值。
参考:http://blog.csdn.net/wawa8899/article/details/52743861
参考:http://www.cnblogs.com/mountaingeek/p/5911291.html
参考:http://www.linuxyw.com/718.html
参考:http://www.iitshare.com/supervisord-manage-process.html
参考:http://stackoverflow.com/questions/20346851/running-celery-as-root
运行生成配置文件:
[[email protected] /]# echo_supervisord_conf > /etc/supervisord.conf ... pkg_resources.DistributionNotFound: meld3>=0.6.5 找到supervisor-3.3.1-py2.7.egg-info/requires.txt,把文件里面meld3 >= 0.6.5注释掉,然后再执行
配置
[program:dopcelerybeat] command=python manage.py celery beat numprocs=1 directory=/data1/vhosts/dop.leju.com/ autostart=true startsecs=10 startretries=3 stopwaitsecs=600 killasgroup=true user=root redirect_stderr=true stdout_logfile=/data1/logs/supervisord-celery-beat.log stderr_logfile=/data1/logs/supervisord-celery-beat-error.log [program:dopceleryworker] command=python manage.py celery worker -l info numprocs=1 directory=/data1/vhosts/dop.leju.com/ autostart=true startsecs=10 startretries=3 stopwaitsecs=600 killasgroup=true user=root redirect_stderr=true stdout_logfile=/data1/logs/supervisord-celery-worker.log stderr_logfile=/data1/logs/supervisord-celery-worker-error.log [group:dopcelery] programs=dopcelerybeat,dopceleryworker ; priority=999 ; the relative start priority (default 999)
运行celery时报错的解决方法:
1st solution - Manually type command at terminal $ export C_FORCE_ROOT=‘true‘ 2nd solution - Edit shell configuration $ vi ~/.bashrc # add following line export C_FORCE_ROOT=‘true‘ $ source ~/.bashrc 3rd solution - Edit manage.py of Django import os if __name__ == ‘__main__‘: os.environ.setdefault(‘C_FORCE_ROOT‘, ‘true‘) os.environ.setdefault(‘DJANGO_SETTINGS_MODULE‘, ‘{PATH TO SETTINGS FILE}‘) execute_from_command_line(sys.argv)
命令supervisorctl可以使用start/stop/status管理每个进程
[[email protected] supervisor-3.3.1-py2.7.egg-info]# supervisorctl dopcelery:dopcelerybeat STOPPED Dec 15 04:40 PM dopcelery:dopceleryworker RUNNING pid 31136, uptime 0:27:58 supervisor> status dopcelery:dopcelerybeat dopcelery:dopcelerybeat STOPPED Dec 15 04:40 PM supervisor>
以上是关于Pythonsupervisor安装和管理celery的主要内容,如果未能解决你的问题,请参考以下文章