com.netflix.zuul.exception.ZuulException: Hystrix Readed time out 解决方法

出现这个问题是在zuul集成多实例后,通过zuul访问Ribbon方法出现的

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

而没有触发配置的服务熔断调用 fallbackMethod但是直接通过Ribbon直接访问确可以触发。

网上搜了半天解决方法大致如下↓

让我在 application.properties 添加这些,改什么时间大小,但是这些我早就配置了,并没有实际解决问题。。

这里吐槽一下别人写的方法,具体是某某的就不说了。。。

###socket超时
zuul.host.socket-timeout-millis=60000
#HTTP连接超时要比Hystrix的大
zuul.host.connect-timeout-millis=10000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=3000
#请求连接的超时时间
ribbon.ConnectTimeout=250
ribbon.ReadTimeout=250

正确的解决方式:

第一种可能:

#在zuul里,重新封装了hytrix的一些配置名称,导致hytrix的一些原生配置会失效
#需要通过zuulProperties重新设置的属性如下:
#隔离级别指定
zuul.ribbonIsolationStrategy=SEMAPHORE
#信号隔离的默认隔离大小
semaphore.maxSemaphores = 20
#指定服务的信号隔离级别大小
zuul.eureka.serviceId.semaphore.maxSemaphores = 20
#而原生的hytrix.command.default.execution.isolation.strategy和maxConcurrentRequests的配置将失效,会被这3个覆盖

第二种可能可能就是zuul路由配置错误导致的,可以参考我的。

#单实例配置1 路由转发
zuul.routes.eureka-server-1.path=/eureka-server-1/**
zuul.routes.eureka-server-1.url=http://localhost:8080/
#单实例配置2 路由转发
zuul.routes.eureka-server-2.path=/eureka-server-2/**
zuul.routes.eureka-server-2.url=http://localhost:8082/

#多实例配置 负载均衡 路由转发
zuul.routes.eureka-server-3.path=/eureka-server-3/**
zuul.routes.eureka-server-3.serviceId=eureka-server
eureka-server-3.ribbon.listOfServers=http://localhost:8080/,http://localhost:8082/

#单实例配置2 客户端 负载均衡  路由转发
zuul.routes.hello-service.path=/hello-service/**
zuul.routes.hello-service.url=http://localhost:8081/
发布了117 篇原创文章 · 获赞 32 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/qq_17025903/article/details/98872483