Java uWSGI和Zuul:每一个请求都会失败
我有一个设置(microservices),其中zuulgateway(localhost)位于一个由uWSGI提供服务的flaskrestapi应用程序(localhost:8080)前面 当我试图通过网关访问API时(例如Java uWSGI和Zuul:每一个请求都会失败,java,python,uwsgi,netflix-zuul,Java,Python,Uwsgi,Netflix Zuul,我有一个设置(microservices),其中zuulgateway(localhost)位于一个由uWSGI提供服务的flaskrestapi应用程序(localhost:8080)前面 当我试图通过网关访问API时(例如curlhttp://localhost/api/endpoint),每隔一次请求都会失败(HTTP 500)。API端没有日志,下面是从非常密集的网关异常日志中提取的: com.netflix.zuul.exception.ZuulException: Forwardin
curlhttp://localhost/api/endpoint
),每隔一次请求都会失败(HTTP 500)。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的角度看没有任何变化。我在这里添加了一篇帖子,让我们看看能得到什么