springcloud组件zuul报Forwarding error问题的解决
https://blog.csdn.net/robin90814/article/details/114872882
使用zuul网关转发请求的时候报com.netflix.zuul.exception.ZuulException: Forwarding error这个错误。请求没有正常转发,
而且这个问题,一会儿有,一会儿就没有,不可控,然后查看控制台除了Forwarding error的错误信息,还有报了个TimeoutException这个异常,应该是转发请求超时导致的。
解决方法如下:
-
手动配置服务路由,然后用这个参数在启动的时候初始化客户端
- zuul:
- ribbon.eager-load.enabled: true
-
几个超时配置做适当调整, 但是别搞太大, 服务还是要控制自己的处理性能
- hystrix:
- command:
- default:
- execution:
- isolation:
- thread:
- timeoutInMilliseconds: 6000
-
- ribbon:
- ConnectTimeout: 500
- ReadTimeout: 3000
一定要注意
timeoutInMilliseconds值要比后面几个值要大,而且不能使用timeout-in-milliseconds

浙公网安备 33010602011771号