1. 程式人生 > >com.netflix.zuul.exception.ZuulException: Hystrix Readed time out

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

  通過API閘道器路由來訪問使用者服務,zuul預設路由規則 :http://zuul的Host地址:zuul埠/要呼叫的服務名/服務方法地址

  瀏覽器中開啟http://127.0.0.1:8000/wallet/system/hello/1
  報錯:
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  Tue Aug 07 17:49:01 CST 2018
  There was an unexpected error (type=Gateway Timeout, status=504).
  com.netflix.zuul.exception.ZuulException: Hystrix Readed time out

這個錯誤是應為zuul的預設超時時間比較小,我們配置下zuul的超時時間,因zuul啟用了ribbon的負載均衡,還需要設定ribbon的超時時間,注意ribbon的超時時間要小於zuul超時時間 。

 

zuul:
  host:
    connect-timeout-millis: 15000 #HTTP連線超時要比Hystrix的大
    socket-timeout-millis: 60000   #socket超時
ribbon:
  ReadTimeout: 10000
  ConnectTimeout: 10000

  

qq群:216868740