配置文件
bind = ‘0.0.0.0:80’
workers = 8
threads = 64
loglevel = ‘debug’
timeout=120
backlog = 1024
worker_class = ‘gevent’
daemon = True
proc_name = ‘xxx’
pidfile = ‘./xx.pid’
accesslog = ‘./log/all.log’
errorlog = ‘./log/error.log’
用上面的的方式启动的时候总是提示worker超时,即使在没有负载的情况下也是这样,使用的是虚拟机。
将worker_class换成默认的sync后就好了
关于worker_class的设置
worker_class
-k STRING, --worker-class STRING
sync
The type of workers to use.
The default class (sync) should handle most “normal” types of workloads. You’ll want to read Design for information on when you might want to choose one of the other worker classes. Required libraries may be installed using setuptools’ extras_require feature.
A string referring to one of the following bundled classes:
sync
eventlet - Requires eventlet >= 0.24.1 (or install it via pip install gunicorn[eventlet])
gevent - Requires gevent >= 1.4 (or install it via pip install gunicorn[gevent])
tornado - Requires tornado >= 0.2 (or install it via pip install gunicorn[tornado])
gthread - Python 2 requires the futures package to be installed (or install it via pip install gunicorn[gthread])
Optionally, you can provide your own worker by giving Gunicorn a Python path to a subclass of gunicorn.workers.base.Worker. This alternative syntax will load the gevent class: gunicorn.workers.ggevent.GeventWorker.