Hystrix Turbine简介
看单个的Hystrix Dashboard的数据并没有什么多大的价值,要想看这个系统的Hystrix Dashboard数据就需要用到Hystrix Turbine。Hystrix Turbine将每个服务Hystrix Dashboard数据进行了整合。Hystrix Turbine的使用非常简单,只需要引入相应的依赖和加上注解和配置就可以了。
引入相应的依赖
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-turbine</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-turbine</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies>
|
在其入口类ServiceTurbineApplication加上注解@EnableTurbine,开启turbine,@EnableTurbine注解包含了@EnableDiscoveryClient注解,即开启了注册服务。
1 2 3 4 5 6 7
| @SpringBootApplication @EnableTurbine public class ServiceTurbineApplication { public static void main(String[] args) { new SpringApplicationBuilder(ServiceTurbineApplication.class).web(true).run(args); } }
|
配置文件application.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| spring: application.name: service-turbine server: port: 8769 security.basic.enabled: false turbine: aggregator: clusterConfig: default appConfig: service-hi,service-lucy clusterNameExpression: new String("default") eureka: client: serviceUrl: defaultZone: http://localhost:8761/eureka/
|
输入监控流http://localhost:8769/turbine.stream