Supervisor Linux进程控制管理

Supervisor 介绍Supervisord是用Python实现的一款非常实用的进程管理工具,类似于monit,monit和supervisord的一个比较大的差异是supervisord管理的进程必须由supervisord来启动,monit可以管理已经在运行的程序;supervisord还要求管理的程序是非daemon程序,supervisord会帮你把它转成daemon程序,因此如果用supervisord来管理nginx的话,必须在nginx的配置文件里添加一行设置daemon off让nginx以非daemon方式启动。官方文档:http://supervisord.org/index.html安装Setuptools

wget -c http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74etar zxvf setuptools-0.6c11.tar.gzcd setuptools-0.6c11python setup.py install

安装Supervisor

easy_install supervisor

supervisor 配置以gearman worker为例:

[unix_http_server]file=/tmp/supervisor.sock   ; (the path to the socket file)[supervisord]logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)logfile_backups=10          ; (num of main logfile rotation backups;default 10)loglevel=info               ; (log level;default info; others: debug,warn,trace)pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)nodaemon=false              ; (start in foreground if true;default false)minfds=1024                 ; (min. avail startup file descriptors;default 1024)minprocs=200                ; (min. avail process descriptors;default 200); the below section must remain in the config file for RPC; (supervisorctl/web interface) to work, additional interfaces may be; added by defining them in separate rpcinterface: sections[rpcinterface:supervisor]supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface[supervisorctl]serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket[program:worker]command= /usr/bin/php worker.phpprocess_name= workernumprocs=1directory=/data/www.ttlsa.comautostart=true           autorestart=true         user=rootstdout_logfile=/data/www.ttlsa.com/worker_stdout.logstdout_logfile_maxbytes=1MBstderr_logfile=/data/www.ttlsa.com/worker_stderr.logstderr_logfile_maxbytes=1MB

supervisor 启动

supervisord -c /usr/local/supervisor/conf/supervisord.conf
Supervisor Linux进程控制管理

相关文章:

你感兴趣的文章:

标签云: