我有一个设置(microservices),其中zuulgateway(localhost)位于flaskrestapi应用程序前面(本地主机:8080)为uWSGI服务。你知道吗
当我试图通过网关访问API时(例如curl http://localhost/api/endpoint
),其他请求都会失败(http500)。API端没有日志,下面是非常密集的网关异常日志的摘录:
com.netflix.zuul.exception.ZuulException: Forwarding error
...
Caused by: com.netflix.client.ClientException: null
...
Caused by: java.lang.RuntimeException: org.apache.http.NoHttpResponseException: localhost:8080 failed to respond
不过,当我直接到达API时(例如curl http://localhost:8080/api/endpoint
),它工作得非常好(每个请求都按预期处理)。你知道吗
另一个有趣的事情是,如果使用flask的开发服务器而不是uWSGI,那么当我试图通过网关访问API时,它是有效的。你知道吗
以下是我的uWSGI设置:
[uwsgi]
wsgi-file = api.py
callable = app
uid = api
gid = api
master = true
processes = 2
threads = 2
http-timeout = 300
socket-timeout = 300
harakiri = 300
http = 0.0.0.0:8080
socket = /tmp/uwsgi.socket
chmod-sock = 664
vacuum = true
die-on-term = true
wsgi-disable-file-wrapper = true
log-date = %%Y-%%m-%%d %%H:%%M:%%S
logformat-strftime = true
logformat = %(ftime) | uWSGI | %(addr) (%(proto) %(status)) | %(method) %(uri) | %(pid):%(wid) | Returned %(size) bytes in %(msecs) ms to %(uagent)
版本是spring-cloud-netflix-zuul-2.1.1.RELEASE.jar
和uwsgi==2.0.17.1
。你知道吗
Wireshark检查显示TCP 8080 -> 80 [RST] Seq=123 Win=0 Len=0
你知道这里有什么问题吗?你知道吗
通过将NGINX放在uWSGI之上来解决。你知道吗
NGINX监听端口8080,并通过unix套接字与uWSGI通信,因此从Zuul的角度来看没有任何变化。你知道吗
相关问题 更多 >
编程相关推荐