2015-06-01 42 views
8

我的設置是春季啓動雲使用netflix庫 我設法讓Turbine從一個服務聚合Hystrix指標。但是,當我添加更多的服務,我不能看到他們。如何添加到渦輪額外的Hystrix指標聚合

這是我的設置(也是在上傳到這一點github上: Project On Github

服務1:

FlightIntegrationService:

@SpringBootApplication 
@EnableCircuitBreaker 
@EnableDiscoveryClient 
@ComponentScan("com.bootnetflix") 
public class FlightIntegrationApplication { 
.. 
} 

application.yaml 

server: 
    port: 0 

eureka: 
    instance: 
    leaseRenewalIntervalInSeconds: 10 
    metadataMap: 
     instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}} 
    client: 
    registryFetchIntervalSeconds: 5 

bootstrap.yaml 

spring: 
    application: 
    name: flight-integration-service 

服務2:

優惠券服務:

@SpringBootApplication 
@EnableCircuitBreaker 
@EnableDiscoveryClient 
@ComponentScan("com.bootnetflix") 
public class CouponServiceApp { 
.. 
} 

application yaml: 

server: 
    port: 0 

eureka: 
    instance: 
    leaseRenewalIntervalInSeconds: 10 
    metadataMap: 
     instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}} 
    client: 
    registryFetchIntervalSeconds: 5 

尤里卡應用服務:

@SpringBootApplication 
@EnableEurekaServer 
public class EurekaApplication { 



Hystrix dashboard service: 

    @SpringBootApplication 
    @EnableHystrixDashboard 
    @Controller 
    public class HystrixDashboardApplication { 

application.yaml:

info: 
    component: Hystrix Dashboard 

endpoints: 
    restart: 
    enabled: true 
    shutdown: 
    enabled: true 

server: 
    port: 7979 

logging: 
    level: 
    ROOT: INFO 
    org.springframework.web: DEBUG 

eureka: 
    client: 
    region: default 


    preferSameZone: false 

    us-east-1: 
     availabilityZones: default 

    instance: 
    virtualHostName: ${spring.application.name} 

bootstrap.yaml

spring: 
    application: 
    name: hystrixdashboard 

終於渦輪服務:

EnableAutoConfiguration 
    @EnableTurbine 
    @EnableEurekaClient 
    @EnableHystrixDashboard 
    public class TurbineApplication { 

application.yaml:

info: 
    component: Turbine 

PREFIX: 

endpoints: 
    restart: 
    enabled: true 
    shutdown: 
    enabled: true 

server: 
    port: 8989 

management: 
    port: 8990 



eureka: 
    instance: 
    leaseRenewalIntervalInSeconds: 10 
    client: 
     serviceUrl: 
     defaultZone: http://localhost:8761/eureka/ 



#turbine: 
# aggregator: 
    # clusterConfig: FLIGHT-INTEGRATION-SERVICE,COUPON-SERVICE 
    #appConfig: flight-integration-service,coupon-service 


#turbine: 
# clusterNameExpression: 'default' 
# appConfig: flight-integration-service,coupon-service 

turbine: 
    appConfig: coupon-service,flight-integration-service 
    clusterNameExpression: new String('default') 




#As you can see I tried diff configurations. 

我到底做錯了什麼?爲什麼我實際上不能聚合兩個服務hystrix指標(航班集成服務,優惠券服務) 謝謝。

+0

您是否嘗試使用turbine.aggregator取消註釋部分,然後添加'?cluster = FLIGHT-INTEGRATION-SERVICE'或' ?cluster = COUPON-SERVICE'到您放入hystrix儀表板的渦輪機網址? – spencergibb

+0

但是,如果我添加LIGHT-INTEGRATION-SERVICE或?cluster = COUPON-SERVICE,那麼我將一次彙總一項服務。我希望看到渦輪機上的所有服務。 – rayman

+0

這不是默認情況下渦輪機的構建方式。 spring-cloud-netflix-turbine-amqp彙總所有服務。 https://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-turbine-amqp – spencergibb

回答

3

通過@spencergibb建議解決。我向每個客戶端添加了spring-boot-starter-amqp的依賴關係,並創建了rabbitMQ代理。 Turbine正在通過amqp彙總所有消息,並且我能夠看到我的hystrix儀表板服務器上彙總的所有Hystrix命令

+0

你可以請你在github上分享你的工作代碼示例...我也是遇到同樣的問題... – PKumar

+0

檢查我的github帳戶在https://github.com/IdanFridman?tab=activity – rayman