1、安装supervisor
easy_install supervisor
2、配置supervisor
echo_supervisord_conf > /etc/supervisord.conf
vim /etc/supervisord.conf
-------------------------------------------------------
[program:tornado_app]
command=python tornado_app.py 80%(process_num)02d
process_name=%(program_name)s_(process_num)02d
umask=022
startsecs=0
stopwaitsecs=0
redirect_stderr=true
stdout_logfile=/tmp/codoon.log
numprocs=4
numprocs_start=1
--------------------
3、重启supervisor
supervisord
supervisorctl reload
查看supervisord和tornado的运行情况:
ps aux
4、配置nignx
--------------------
upstream frontends {
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
server 127.0.0.1:8004;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://frontends;
proxy_next_upstream error;
}
--------------------
保存配置文件后执行 让nginx重启的指令 nginx -s reload