【问题标题】:hystrix.stream, management.port and Spring Cloud Turbinehystrix.stream、management.port 和 Spring Cloud Turbine
【发布时间】:2016-07-28 10:41:03
【问题描述】:

我的带有@EnableTurbine 配置的微服务:

turbine:
  clusterNameExpression: new String('default')
  appConfig: bestallning

bestallning 是一个@SpringCloudApplication,启用了 hystrix.stream。它在 eureka 中注册,并且涡轮应用程序可以找到它。但它的 management.port 设置为 8092,server.port 设置为 8082。hystrix.stream 绑定到 management.port

Turbine 现在尝试从 bestallning 的 server.port 获取 hystrix.stream,而不是 hystrix.stream 绑定的 management.port。

   Fetching instance list for apps: [bestallning]
   Fetching instances for app: bestallning
   Received instance list for app: bestallning, size=1
   Retrieved hosts from InstanceDiscovery: 1
   Found hosts that have been previously terminated: 0
   Hosts up:1, hosts down: 0
   Url for host: http://143.237.21.196:8082/hystrix.stream default
   Could not initiate connection to host, giving up: [{"timestamp":1460035761979,"status":404,"error":"Not Found","message":"No message available","path":"/hystrix.stream"}]
   Stopping InstanceMonitor for: 143.237.21.196 default

是否可以让涡轮机使用正确的端口查找 hystrix.stream?

【问题讨论】:

    标签: spring-boot spring-cloud hystrix turbine spring-cloud-netflix


    【解决方案1】:

    我认为您必须编写自己的 InstanceDiscovery(并创建该类型的 @Bean)。不过在现有实现中可能是一个有用的功能,所以请在 Spring Cloud Netflix 中打开一个问题。

    【讨论】:

    • 我复制了EurekaInstanceDiscovery(因为eurekaClient 和marshall 是私有的:-P)并用@Component 注释它。将management-port: ${management.port} 添加到每个application.yaml eureka 实例元数据中,并在marshall 中获取它以用作端口......似乎有效。将打开问题.. 谢谢!
    • 有一个属性turbine.instanceUrlSuffix可以设置。
    猜你喜欢
    • 2017-03-09
    • 2015-05-12
    • 2020-08-10
    • 1970-01-01
    • 2017-03-19
    • 2018-08-17
    • 2016-04-14
    • 2015-10-06
    • 2018-02-28
    相关资源
    最近更新 更多