赞
踩
gunicorn conf配置内容
import multiprocessing # 并行工作进程数 workers = multiprocessing.cpu_count() * 2 + 1 # 指定每个工作者的线程数 threads = 2 # 设置最大并发量 worker_connections = 2000 # 指定工作进程使用的worker类 worker_class = "uvicorn.workers.UvicornWorker" port = 8090 bind = f"0.0.0.0:{port}" # 设置守护进程,将进程交给supervisor管理 # daemon = 'false' # daemon = True pidfile = '/home/car/log4DSM/gunicornDSM.pid' loglevel = 'info' errorlog = '/home/car/log4DSM/gunicorn-errorDSM.log' accesslog = '/home/car/log4DSM/gunicorn-access.log' access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
supervisord 配置内容
[program:dsm] ;项目名称
directory = /home/car/dsm-master ;
command = /home/car/dsm-master/venv/bin/gunicorn -D --config /home/car/dsm-master/app/gunicorn.conf.py startup:app ;
autostart = true ; 在 supervisord 启动的时候也自动启动
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了
autorestart = true ; 程序异常退出后自动重启
startretries = 3 ; 启动失败自动重试次数,默认是 3
user = root ; 用哪个用户启动
redirect_stderr = true ; 把 stderr 重定向到 stdout,默认 false
stdout_logfile_maxbytes = 50MB ; stdout 日志文件大小,默认 50MB
stdout_logfile_backups = 20 ; stdout 日志文件备份数
loglevel=info
[supervisord]
[supervisorctl]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。