spring-cloud-zuul超时配置不起作用 [英] spring-cloud-zuul timeout configuration does not work

查看:893
本文介绍了spring-cloud-zuul超时配置不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据spring cloud zuul 8.1.3 zuul超时,以下配置应使zuul超时20秒,但是,它会在10秒后超时.

according to spring cloud zuul 8.1.3 zuul timeout, the following configuration should make zuul timeout after 20 seconds, however, it times out at 10 seconds.

server:
  port: 8769
spring:
  application:
    name: service-zuul
zuul:
  host:
    connect-timeout-millis: 20000
    socket-timeout-millis: 60000
zuul:
  routes:
    tp:
      path: /**
      url: http://localhost:9998
ribbon:eureka:enabled: false

从控制台输出中可以看到,过滤器和超时异常之间的间隔只有10秒.这意味着zuul.host.connect-timeout-millis不起作用.

From console output one can see that the interval between filter and timeout exception is only 10 seconds. which means the zuul.host.connect-timeout-millis does not work.

推荐答案

我终于找到了解决方案:

I finally found a solution:

我以前使用过属性,这是第一次尝试yml,看来必须将一项汇总为一个前缀:

I used properties before and this is the first time to try yml, it seems that an item must be aggregated into one prefix:

zuul:
  host:
    connect-timeout-millis: 20000
    socket-timeout-millis: 60000
  routes:
    tp:
      path: /**
      url: http://localhost:9998

这样,后端服务器最多可以有60秒的响应时间.此外,我还发现配置顺序很重要.

In this way the backend server could have at most 60 seconds to respond. Besides, I also found that the sequence in configuration matters.

这篇关于spring-cloud-zuul超时配置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆