ray*_*man 8 netflix turbine spring-boot hystrix spring-cloud
我的设置是使用netflix库的spring boot cloud我设法让Turbine从一个服务聚合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
Run Code Online (Sandbox Code Playgroud)
服务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
Run Code Online (Sandbox Code Playgroud)
Eureka应用服务:
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
Hystrix dashboard service:
@SpringBootApplication
@EnableHystrixDashboard
@Controller
public class HystrixDashboardApplication {
Run Code Online (Sandbox Code Playgroud)
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}
Run Code Online (Sandbox Code Playgroud)
bootstrap.yaml
spring:
application:
name: hystrixdashboard
Run Code Online (Sandbox Code Playgroud)
最后是涡轮机服务:
EnableAutoConfiguration
@EnableTurbine
@EnableEurekaClient
@EnableHystrixDashboard
public class TurbineApplication {
Run Code Online (Sandbox Code Playgroud)
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.
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?为什么我不能实际汇总两个服务hystrix指标(航班整合服务,优惠券服务)谢谢.
通过@spencergibb建议解决。我向每个客户端添加了 spring-boot-starter-amqp 的依赖项并创建了rabbitMQ代理。Turbine 正在通过 amqp 聚合所有消息,我能够看到在我的 hystrix 仪表板服务器上聚合的所有 Hystrix 命令
归档时间: |
|
查看次数: |
3625 次 |
最近记录: |