ribbon: eager-load: enabled: true clients: client1,client2@H_404_0@ 对于Zuul:
zuul: ribbon: eager-load: enabled: true@H_404_0@ 2) 方法二:延长 Hystrix 的超时时间,示例如下 @H_404_0@ hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds:5000 @H_404_0@ 该配置让 Hystrix 的超时时间改为5秒。 @H_404_0@ 3) 方法三:禁用 Hystrix 的超时,示例如下 @H_404_0@ hystrix.command.default.execution.timeout.enabled: false @H_404_0@ 方法四:对于 Feign , 还可以为 Feign 禁用 Hystrix , 示例如下 @H_404_0@ feign.hystrix.enabled: false @H_404_0@ 这样即可为 Feign 全局禁用 Hystrix 支持。但该方式比较极端,一般不建议使用。 @H_404_0@ 二、turbine 聚合数据不完整 @H_404_0@ 在某些版本的Spring Cloud (例如 Brixton SR5)中,turbine 会发生该问题。该问题的直接观体现是: @H_404_0@ 使用 turbine 聚合多个微服务,但在 Hystrix Dashboard 上只能看到部分微服务的监控数据。 @H_404_0@ 现象描述: @H_404_0@ 比如 turbine 配置如下: @H_404_0@ turbine 理应聚合 cloud-consumer-movie,cloud-consumer-movie-feign-hystrix-fallback-stream 这两个微服务的监控数据,然而打开 Hystrix Dashboard 时,会发现Dashboard 上只显示部分微服务的监控数据。 @H_404_0@ 解决方案: @H_404_0@ 当 turbine 聚合的微服务部署在同一台主机上时,就会出现该问题。 @H_404_0@ 解决方案一: @H_404_0@ 为各个微服务配置不同的 hostname ,并将 preferIpAddress 设为 false 或者不设置。
eureka: client: serviceUrl: defaultZone:http://127.0.0.1:8001/eureka/ instance: hostname:ribbon # 配置hostname@H_404_0@解决方案二: @H_404_0@设置turbine.combine-host-port = true
turbine: appConfig: cloud-consumer-movie,cloud-consumer-movie-feign-hystrix-fallback-stream clusterNameExpression:"'default'" combine-host-port:true@H_404_0@ 方法三: @H_404_0@ 升级 Spring Cloud 到 Camden 或更新版本。当然,也可单独升级 Spring Cloud Netflix 到 1.2.0以上最新稳定版(一般不建议单独升级 Spring Cloud Netflix, 因为可能会跟 Spring Cloud 其他组件冲突)。 @H_404_0@ 这是因为老版本中的 turbine.combine-host-port 默认值是 false 。Spring Cloud 已经意识到该问题,故在新的版本中将该属性的默认值设为 true 。该解决方案和方法二本质是一致的。 @H_404_0@ 相关代码
org.springframework.cloud.netflix.turbine.turbineProperties.combine-HostPort org.springframework.cloud.netflix.turbine.CommonsInstancediscovery.getInstance(String, String, String, Boolean)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。