supervisor安裝文檔java
######################python
安裝需求:python2.7以上版本web
python2.6升級:apache
一、下載Python-2.7.15
wget http://python.org/ftp/python/2.7.15/Python-2.7.15.tar.bz2 tomcat
二、解壓
tar -jxvf Python-2.7.15.tar.bz2python2.7
三、
cd Python-2.7.3
#./configure --prefix=/usr/local/python2.7
#make
#make install
###注意:安裝時先安裝 zlib zlib-devel
四、創建軟鏈接,使系統默認的 python指向 python2.7
#mv /usr/bin/python /usr/bin/python2.6.6
#ln -s /usr/local/bin/python2.7 /usr/bin/python socket
五、修改yum
vi /usr/bin/yum
將文件頭部的ui
#!/usr/bin/pythonurl
改爲
#!/usr/bin/python2.6
###################debug
安裝python pkg 包:distribute-0.6.10.zip (python2.7)
#unzip distribute-0.6.10.zip
#python setup.py install
安裝: supervisor
#yum install python-setuptools
#/usr/local/python2.7/bin/easy_install supervisor
默認安裝 /usr/local/python2.7/bin 目錄下:
supervisord 、echo_supervisord_conf、supervisorctl
生成配置文件:
#./echo_supervisord_conf > supervisord.conf
配置文件以下:
[tomcat@footballweb supervisor]$ cat supervisord.conf |grep -v ^\;
[unix_http_server]
file=/tmp/supervisor.sock ; the path to the socket file
[inet_http_server] ; inet (TCP) server disabled by default
port=0.0.0.0:39001 ; ip_address:port specifier, *:port for all iface 頁面管理地址
username=huitou ; default is no username (open server) --登錄用戶名/密碼
password=huitou&365 ; default is no password (open server)
[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 ; # of main logfile backups; 0 means none, 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
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
prompt=mysupervisor ; cmd line prompt (default "supervisor")
history_file=~/.sc_history ; use readline history if available
[program:tomcat_8081]
command=/opt/apache-tomcat-7.0.81_8081/bin/catalina.sh run ; 程序啓動命令
environment=JAVA_HOME="/usr/java/jdk1.7.0_71",JAVA_BIN="/usr/java/jdk1.7.0_71/bin",LANG="zh_CN.GB18030" ;
directory=/opt/apache-tomcat-7.0.81_8081 ;
autostart=true ; 在supervisord啓動的時候也自動啓動
startsecs=20 ; 啓動10秒後沒有異常退出,就表示進程正常啓動了,默認爲1秒
autorestart=true ; 程序退出後自動重啓,[unexpected,true,false],默認爲unexpected,表示進程意外殺死後才重啓
startretries=3 ; 啓動失敗自動重試次數,默認是3
user=tomcat ; 用哪一個用戶啓動進程,默認是root
priority=999 ; 進程啓動優先級,默認999,值小的優先啓動
redirect_stderr=true ; 把stderr重定向到stdout,默認false
stdout_logfile_maxbytes=20MB ; stdout 日誌文件大小,默認50MB
stdout_logfile_backups = 20 ; stdout 日誌文件備份數,默認是10
stdout_logfile=/opt/apache-tomcat-7.0.81_8081/logs/supervisor_catalina.out ;
stopasgroup=true ;默認爲false,進程被殺死時,是否向這個進程組發送stop信號,包括子進程
killasgroup=true ;默認爲false,向進程組發送kill信號,包括子進程
supervisor啓動:
#./supervisord -c ./supervisord.conf