SpringFeign 的 Hystrix 熔断器出现 timed-out and no fallback available 错误

Hystrix 熔断器默认超时时间是 1 秒钟,我们需要在配置中修改它的超时时间配置,同时也要设置 ribbon 的超时时间。

解决方法:application中配置以下

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 5000  #熔断超时时间

ribbon:
  ReadTimeout: 60000  #请求处理的超时时间
  ConnectTimeout: 60000 #请求连接超时时间
  MaxAutoRetries: 0 #对当前实例的重试次数
  MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1

tips:只配置 Ribbon 或者只配置了 hystrix 的超时时间是不行的,需要同时配置

猜你喜欢

转载自www.cnblogs.com/joequa/p/12690320.html