ini supervisord.conf

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini supervisord.conf相关的知识,希望对你有一定的参考价值。

; supervisor config file

[inet_http_server]
port=127.0.0.1:9001

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; 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=http://127.0.0.1:9001;

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisord.d/*.ini

Django 使用gunicorn 和 supervisord部署

Django 使用gunicorn 和 supervisord部署

项目部署目录为/code,有2个服务 一个为web服务,一个为任务服务

生成配置文件

echo_supervisord_conf > /code/supervisord.conf

/code/supervisord.conf配置

[program:ccu]
command=/code/py/bin/gunicorn --chdir /code/project --pythonpath /code/py/ -k gthread --thread 40 --max-requests 4096 --max-requests-jitter 512 -w 4 -b0.0.0.0:8000 project.wsgi
directory=/code/project
startsecs=0
stopwaitsecs=0
autostart=true
autorestart=true

[program:ccu_cron]
command=/code/py/bin/python3 /code/project/run.py
directory=/code/project
startsecs=0
stopwaitsecs=0
autostart=true
autorestart=true

gunicorn 参数说明

name Value
chdir 加载应用程序之前将chdir目录指定到指定目录
pythonpath 路径加到python path
max-requests 工作将处理的最大请求数(静态数值)
max-requests-jitter 工作将处理的最大请求数(动态数值)randint(0, max_requests_jitter)
-w 表示开启多少个worker
project.wsgi project/wsgi.py 文件

supervisorctl 基本命令

supervisorctl -c /code/supervisord.conf status              查看状态
supervisorctl -c /code/supervisord.conf reload              重新载入配置文件
supervisorctl -c /code/supervisord.conf start [all]|[x]     启动所有/指定的程序进程
supervisorctl -c /code/supervisord.conf stop [all]|[x]      停止所有/指定的程序进程

以上是关于ini supervisord.conf的主要内容,如果未能解决你的问题,请参考以下文章

ini supervisord.conf的配置文件示例

ini supervisord.conf

ini supervisord_graphite_statsd.conf

python能检测软件状态吗

Linux centos 安装 supervisor 管理 Laravel 队列

Supervisord安装和配置