SpringCloud - com.netflix.zuul.exception.ZuulException: Hystrix Readed time out

问题发现原来是我们在浏览器输入地址通过Zuul网关来访问我的产品服务,而Zuul网关的默认路由地址是http://zuul网关的Host地址:zuul端口/要调用的服务名/服务方法地址

因为我采用了Fegin,底层也是使用的是Ribbon负载均衡,Zuul的默认超时时间比较小,所以我将Zuul的超时时间大于ribbon的超时时间,于是就不再显示超时异常了。

解决方案

server:
  port: 20001

spring:
  application:
    name: dsp-zuul-admin

zuul:
  host:
    connect-timeout-millis: 60000 # HTTP连接超时大于Hystrix的超时时间
    socket-timeout-millis: 60000 # socket超时
  routes:
    dsp-api-metadata:
      path: /dsp-api-metadata/**
      url: http://localhost:8081
      stripPrefix: false

    dsp-api-caller:
      path: /dsp-api-caller/**
      url: http://localhost:8084
      stripPrefix: false

    dsp-srm-manage:
      path: /dsp-srm-manage/**
      url: http://localhost:8082
      stripPrefix: false

    dsp-service-manage:
      path: /dsp-service-manage/**
      url: http://localhost:8083
      stripPrefix: false

    dsp-service-orchestration:
      path: /dsp-service-orchestration/**
      url: http://localhost:8085
      stripPrefix: false

    dsp-service-executor:
      path: /dsp-service-executor/**
      url: http://localhost:8086
      stripPrefix: false

ribbon: # 设置ribbon的超时时间小于zuul的超时时间
  ReadTimeout: 60000
  ConnectTimeout: 60000

猜你喜欢

转载自blog.csdn.net/Dream_Weave/article/details/107653985