用supervisor管理uWSGI,supervisoruwsgi,Supervisor,
用supervisor管理uWSGI,supervisoruwsgi,Supervisor,
Supervisor, is a client/server system that allows its users to monitor and control a bumber of processes on UNIX-like operation systems. 飞龙博客有篇<用Supervisord管理Python进程>, Here. 还有篇 <Django on uWSGI and Nginx> 里面也有涉及在supervisor中管理uWSGI:
[program:myapp] command=/usr/local/sbin/uwsgi --home /home/myuser/.virtualenvs/myapp/ --module myapp.deploy.wsgi --socket 10.1.2.3:10000 --pythonpath /sites/myapp.com/code/myapp --processes 5 --master --harakiri 120 --max-requests 5000 directory=/sites/myapp.com/code/myapp environment=DJANGO_SETTINGS_MODULE='myapp.settings' user=www-data autostart=true autorestart=true stdout_logfile=/sites/myapp.com/logs/uwsgi.log redirect_stderr=true stopsignal=QUIT
在uWSGI指定了--master/-M, supervisor没有设置stopsignal=QUIT(默认为TERM)情况, supervisor stop program后, 显示是stopped, 但其实uWSGI依旧在运行, 在stackoverflow有个非直接解析, 这里:
You should always add --master/-M on uwsgi even under supervisord, this will allow to restart apps without losing the socket (and without spitting out an error to clients during restart).
uWSGI的master是个好东西, 但supervisor默认的stopsignal使uWSGI挂了一次, 然后uWSG的master又重启apps. 不注意细节带来的非期望结果.
supervisor把program转为daemon模式, 所以uWSGI不用自己加deamonize.
ps. 控制supervisor的program启动顺序, 用的是priority, "Higer priorities indicate programs that start last and shut down first"
相关内容
- python2.7 + webpy 的bug SystemError: ../Objects/tupleobject.c:142: b
- Python 的可逆加密算法DES实现,pythondes,pyDES 是一个Pyt
- 如何安装windows版本的pycrypto,windowspycrypto,pycrypto的win
- 使用PyCrypto做AES加密,pycryptoaes加密,#!/usr/bin/e
- python PyCrypto AES加密和可逆的CryptoJS的AES加密,pycryptoc
- Python数据库连接池DBUtils.PooledDB,,python不用连接池的
- python ORM SQLAlchemy 使用示例,ormsqlalchemy,ORM方法论基于三
- C#, Java, PHP, Python和Javascript几种语言的AES加密解密实现,
- Python异步读取子进程输出,python异步进程,python的subpr
- 如何获得python实例的class名称,python实例class,有几种方
评论关闭