Turbine instanceURLSuffix无法正常工作

时间:2016-09-15 12:37:13

标签: spring spring-cloud turbine

我从涡轮机收集hystrix流,但服务在端口5555上启用了管理端口。

当我在涡轮机中设置属性时:

eureka.client.serviceUrl.defaultZone=http://discovery:8761/eureka/

server.port=8989

InstanceDiscovery.impl=com.netflix.turbine.discovery.EurekaInstanceDiscovery.class

turbine.instanceUrlSuffix=:5555/hystrix.stream
turbine.InstanceMonitor.eventStream.skipLineLogic.enabled=false
turbine.appConfig=service1,service2,gateway
turbine.clusterNameExpression=new String('default')

它尝试连接到:

http://gateway-ip:10000/:5555/hystrix.stream

而不是替换端口。我有什么遗失的吗?

更新

我怀疑instanceUrlSuffix和EurekaInstanceDiscovery之间存在不兼容性。

我是否需要在metadataMap中为该服务添加任何信息才能使其正常工作?

  

版本是:

     

涡轮机服务:

     
      
  • spring-cloud-starter-parent:Brixton.SR5
  •   
  • spring-cloud-starter-turbine:1.1.6
  •   
     

尤里卡服务:

     
      
  • spring-cloud-starter-parent:Brixton.SR5
  •   

3 个答案:

答案 0 :(得分:2)

为了使其工作,我必须将这两个属性添加到配置中:

turbine:
  instanceInsertPort: false
  instanceUrlSuffix: :5555/hystrix.stream

turbine.instanceInsertPort就是诀窍,组成了schema://host+urlSuffix

的最终网址

答案 1 :(得分:0)

以下为我工作。 注意:默认配置文件对我来说也不起作用,但是单个流以这种方式工作。

我的service1使用-Dserver.port = 5151和-Dmanagement.port = 5152注册到Eureka,因此我的hystrix流位于与我的服务端点不同的端口上。

turbine.instanceInsertPort=false
turbine.appConfig=service1
turbine.aggregator.clusterConfig=SERVICE1
turbine.instanceUrlSuffix.USER=:5152/hystrix.stream
InstanceDiscovery.impl=com.netflix.turbine.discovery.EurekaInstanceDiscovery.class

答案 2 :(得分:0)

Turbine 无法读取 application.property 或 environment 中的 'turbine.instanceUrlSuffix',需要其他库来读取属性。

您是否依赖 lib cflow()within()?如果没有,请尝试将其添加到您的 pom.xml。

this()