timed-out and fallback failed

Feign 的负载均衡底层用的就是 Ribbon,Feign的重试机制默认是关闭的,所以使用Ribbon来控制超时。

解决办法
配置ribbon的ConnectTimeout和ReadTimeout

# ribbon负载均衡
ribbon:
  eager-load:
    enabled: true # 饥饿加载(eager-load)模式
  MaxAutoRetries: 1 # 对当前实例的重试次数
  MaxAutoRetriesNextServer: 2 # 切换实例的重试次数
  ConnectTimeout: 10000 # 连接超时时间
  ReadTimeout: 20000 # 读取数据超时

# hystrix断路器
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 60000 # 60s,路由转发时HystrixCommand的执行超时时间,执行超过该时间会进行服务降级处理
————————————————
版权声明:本文为CSDN博主「司马缸砸缸了」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yy756127197/article/details/106604654

猜你喜欢

转载自blog.csdn.net/zhongguowangzhan/article/details/128310992