SpringCloud------Zuul报错

1

1)报错信息

Description:

The bean 'counterFactory', defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulCounterFactoryConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulMetricsConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

 

2)原因

SpringCloud和SpringBoot版本不兼容

 

3)兼容版本

 

2.

1)报错信息

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

 

2)原因

这个错误是应为zuul的默认超时时间比较小,我们配置下zuul的超时时间,因zuul启用了ribbon的负载均衡,还需要设置ribbon的超时时间,注意ribbon的超时时间要小于zuul超时时间

 

3)解决方法

修改application.yml配置

zuul:
#zuul使用Ribbon负载均衡,所以要配置ribbon超时时间,否则很短
  host:
    connect-timeout-millis: 15000 #HTTP连接超时要比Hystrix的大
    socket-timeout-millis: 60000   #socket超时
ribbon:
  ReadTimeout: 10000
  ConnectTimeout: 10000

 

posted @ 2020-03-15 00:13  玉天恒  阅读(786)  评论(0编辑  收藏  举报