我如何更改Zuul API网关的读取超时

时间:2020-01-10 11:23:04

标签: spring-boot netflix-zuul

我通过指定URL路由在所有服务发现中都使用Zuul API网关,并且由于以下情况我总是收到以下读取超时异常,因为我的请求需要大量时间来获得响应。 如何更改application.yml中的读取超时属性?

    "timestamp": 1578652198489,
    "status": 500,
    "error": "Internal Server Error",
    "exception": "com.netflix.zuul.exception.ZuulException",
    "message": "Read timed out",
    "trace": "com.netflix.zuul.exception.ZuulException: Read timed out

1 个答案:

答案 0 :(得分:0)

来自springboot和Zuul文档(https://cloud.spring.io/spring-cloud-netflix/multi/multi__router_and_filter_zuul.html#_zuul_timeouts

如果通过指定URL配置了Zuul路由,则需要使用 zuul.host.connect-timeout-millis zuul.host .socket-timeout-millis

在您的.yml文件中:

zuul:
  host:
    connect-timeout-millis: 90000 
    socket-timeout-millis: 90000