为什么主管总是使芹菜工作者从头到尾地转换表格? [英] Why the supervisor make the celery worker changing form running to starting all the time?

查看:107
本文介绍了为什么主管总是使芹菜工作者从头到尾地转换表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

backgroud


系统是Centos7,具有python2.x。 1GB内存和单核。


我安装了python3.x,可以将python3编码为python3。


django-celery项目基于一个virtualenv python3.x,我在nginx,uwsgi,mariadb上做得很好。至少,我认为这样不会发生任何错误。


我尝试使用主管来控制django-celery的工人,如下所示:

  command = env / bin / python project / manage.py celeryd -l INFO -n worker _%(process_num)s 
numprocs = 4
process_name = projects_worker _%(process_num) s
stdout_logfile = logfile.log
etderr_logfile = logfile_err.log

还对芹菜进行了设置事件,芹菜节拍,这部分很好,没有发生错误。错误来自工作人员。


当我将进程保持大于1时,当我执行 supervisorctl身份,所有命令都在运行。


但是,当我再次执行相同的命令以再次查看状态时,某些进程状态将更改为开始。


因此,我尝试了更多次,发现:工人的状态总是从运行状态更改为启动状态,然后从开始状态更改为运行状态-不停止。


当我在tmp中检查主管的日志文件时/supervisor.log,显示如下:

 退出状态1;没想到
进入了中断状态,进程已暂停了>超过1秒(startsecs)
'project_worker_0',pid为2284

也许它显示了为什么工人全部更改状态


此外,当我将过程更改为1时,工人可能会失败。工人的日志显示给我:

 陈旧的pidfile存在。将其删除

但是,我没有将pidfile路径指向worker。 ,我只是在 / 路径中找到了事件并击败了pidfie,没有工作者的pidfile。此外,我尝试了 find / -name * .pid 来查找像worker或celeryd这样的pidfile,但是这里不存在。


问题



  • 首先,我想部署该项目,那么,这里是否还有其他方法来部署virtulanev的芹菜部分的django-celery?



  • 如果在这里任何人都可以告诉我这种现象是怎么发生的,我最好选择主管来部署芹菜部分。任何人都可以帮助我吗?




PS


您的任何想法

解决方案

最后,我昨天晚上解决了这个问题。



原因




  • 我使项目可以在Windows 10系统上成功运行,但是将项目更改为centos7。+时没有检查。命令: env / bin / python project / manage.py celeryd 无法成功运行。因此,主管将启动将很快失败的过程。


  • 为什么命令无法成功?我已经安装了所有软件包所需的pip。但是它在下面显示了错误:


    当工作人员接受用pickle序列化的消息时,以超级用户特权运行该工作人员是一个非常糟糕的主意! p>

    如果您确实要继续,则必须设置C_FORCE_ROOT
    环境变量(但请在使用前先考虑一下)。



    用户信息:uid = 0 euid = 0 gid = 0 egid = 0


    我尝试搜索一些关于此错误的博客,并获得分析者:


    export C_FORCE_ROOT ='true'#在中心环境





解决问题的措施(遇到类似错误后)




  • 在centos的环境文件中添加 export C_FORCE_ROOT ='true'并将其来源。


  • 检查命令'env / bin / python project / manage.py celeryd',是否运行成功。


  • 重新启动监控程序。请注意!不是 supervisorctl reload ,它只是重新加载.conf文件,而不是环境文件。尝试杀死进程 supervisord -c xx.conf ps aux | grep主管 kill -9 process_number ,请小心)。




有关博客的一些网址




backgroud

The system is Centos7, which have a python2.x. 1GB memory and single core.

I install python3.x , I can code python3 into python3.

The django-celery project is based on a virtualenv python3.x,and I had make it well at nginx,uwsgi,mariadb. At least,I think so for no error happend.

I try to use supervisor to control the django-celery's worker,like below:

command=env/bin/python project/manage.py celeryd -l INFO -n worker_%(process_num)s
numprocs=4
process_name=projects_worker_%(process_num)s
stdout_logfile=logfile.log
etderr_logfile=logfile_err.log

Also had make setting about celery events,celery beat,this part is well ,no error happend. Error comes from the part of worker.

When I keep the proces big than 1,it would run at first,when I do supervisorctl status,all are running.

But when I do the same command to see status once more times,some process status change to starting.

So I try more times,I found that:the worker's status would always change from running to starting and then changeing starting to running-- no stop.

When I check the supervisor's logfile at tmp/supervisor.log,it shows like:

exit status 1; not expected
entered runnging state,process has stayed up for > than 1 seconds(startsecs)
'project_worker_0' with pid 2284

Maybe it shows why the worker change status all the time.

What's more ,when I change the proces to 1,the worker could failed.The worker's log show me:

stale pidfile exists.Removing it

But,I did not ponit the pidfile path to worker.And,I just found the events's and beat 's pidfie at the / path,no worker's pidfile.Also ,I try find / -name *.pid to find a pidfile like worker,or celeryd,but here did not exist.

question

  • firstly, I want to deploy the project , so ,did here any other way to deploy the django-celery with virtulanev's celery part?

  • If here anyone can tell me how this phenomenon comes,I would better to choose supervisor to deploy the celery part. Anyone can help me about it ?

PS

Any of your thoughts may be helpful to me, best wishs!

解决方案

Finally, I solve this problem yesterday night.

about the reason

  • I make the project could success running at a windows 10 system, but did no check when I change the project to centos7.+. The command:env/bin/python project/manage.py celeryd could not run success. So the supervisor would start a process which will failed soon.

  • Why the command could not success? I had pip installed all the package need. But it show err below:

    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

    I try to search some blog about this error, and get the anser:

    export C_FORCE_ROOT='true' # at the centos enviroument

action to solve(after meeting error like this)

  • add export C_FORCE_ROOT='true' to centos's enviroment file and source it.

  • check command 'env/bin/python project/manage.py celeryd ',did it run successful.

  • restart the supervisord. Attention please! not supervisorctl reload,it just reload the .conf file,not the environment file. Try kill the process supervisord -c xx.conf(ps aux | grep supervisord and kill -9 process_number,be careful).

some url about the blog

这篇关于为什么主管总是使芹菜工作者从头到尾地转换表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆