之前的文章说过Turbine聚集consumer的服务容错数据,
SpringCloud之监控数据聚合Turbine+RabbitMQ
本次文章阐述Hystrix-DashBoard如何把Turbine的数据展现在面板上
在pom.xml中引入依赖,
springboot的版本为1.5.15
springcloud的版本为Edgware.SR4
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
在application.yml简单配置
server:
port: 11000
spring:
application:
name: hystrix
eureka:
instance:
prefer-ip-address: true
instance-id: hystrix:11000
client:
service-url:
defaultZone: http://localhost:7001/eureka/
在启动类中开启@EnableHystrixDashboard
访问 hystrix首页 :http://localhost:11000/hystrix
监控turbine从从consumer中聚集的数据 :http://localhost:10000/turbine.stream
@EnableDiscoveryClient
@EnableHystrixDashboard
@SpringBootApplication
public class HystrixApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixApplication.class, args);
}
}