gunicorn常用配置

<h1>可以将gunicorn 配置单独隔离成py文件
eg:
<h5>gunicorn.py

workers = 4
bind = "127.0.0.1:8086"
backlog = 2048
timeout = 60
keepalive = 2
#errorlog = '_error.log'
loglevel = 'info'
#accesslog = '_access.log'
worker_class = 'gevent'
worker_connections = 1000
threads = 2

gunicorn配置:

[group:blog_group]
programs=blog
[program:blog_group]
command=/home/blog_group/env/bin/python /home/blog_group/env/bin/gunicorn -c gunicorn.py blog.wsgi:application
directory=/home/blog_group
user=root
autorestart=true
redirect_stderr=true
stdout_logfile_maxbytes = 100MB
stdout_logfile_backups = 10
stdout_logfile=/var/log/supervisor/blog_group.log
loglevel=error
startsecs=10

<h1>命令行参数

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -c FILE, --config=FILE
                        The path to a Gunicorn config file. [None]
  --debug               Turn on debugging in the server. [False]
  --spew                Install a trace function that spews every line
                        executed by the server. [False]
  --access-logfile=FILE
                        The Access log file to write to. [None]
  --access-logformat=STRING
                        The Access log format . [%(h)s %(l)s %(u)s %(t)s
                        "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"]
  --error-logfile=FILE, --log-file=FILE
                        The Error log file to write to. [-]
  --log-level=LEVEL     The granularity of Error log outputs. [info]
  --logger-class=STRING
                        The logger you want to use to log events in gunicorn.
                        [simple]
  -n STRING, --name=STRING
                        A base to use with setproctitle for process naming.
                        [None]
  --preload             Load application code before the worker processes are
                        forked. [False]
  -D, --daemon          Daemonize the Gunicorn process. [False]
  -p FILE, --pid=FILE   A filename to use for the PID file. [None]
  -u USER, --user=USER  Switch worker processes to run as this user. [1000]
  -g GROUP, --group=GROUP
                        Switch worker process to run as this group. [1000]
  -m INT, --umask=INT   A bit mask for the file mode on files written by
                        Gunicorn. [0]
  -b ADDRESS, --bind=ADDRESS
                        The socket to bind. [127.0.0.1:8000]
  --backlog=INT         The maximum number of pending connections.     [2048]
  -w INT, --workers=INT
                        The number of worker process for handling requests.
                        [1]
  -k STRING, --worker-class=STRING
                        The type of workers to use. [sync]
  --worker-connections=INT
                        The maximum number of simultaneous clients. [1000]
  --max-requests=INT    The maximum number of requests a worker will process
                        before restarting. [0]
  -t INT, --timeout=INT
                        Workers silent for more than this many seconds are
                        killed and restarted. [30]
  --keep-alive=INT      The number of seconds to wait for requests on a Keep-
                        Alive connection. [2]
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 7,821评论 0 3
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 13,210评论 0 13
  • Introduction Django is a powerful web framework that can ...
    㗊𨰻木㵘燚㙓㗊阅读 6,872评论 0 0
  • 英文文档,一开始我也是抗拒的,边翻译边看,也就花费了1个小时基本就阅读过了,我的英文基础其实很差。附上链接:链接:...
    lonecolonel阅读 13,457评论 3 1
  • 诸葛亮出生于公元一百八十一年,逝于二百三十四年,字孔明,号卧龙,琅琊阳都,今山东沂南人,三国时期蜀汉丞相,杰出的政...
    战神_b55c阅读 1,832评论 0 2

友情链接更多精彩内容