spring cloud turbine
参考博客:http://www.ityouknow.com/springcloud/2017/05/18/hystrix-dashboard-turbine.html
spring boot版本:2.0.3.RELEASE
pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-turbine</artifactId> </dependency> <!-- hystrix --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <!-- Hystrix-dashboard熔断器监控工具 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-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-test</artifactId> <scope>test</scope> </dependency>
application.yml
spring:
application:
name: spring-cloud-turbine-wly
server:
port: 8082
turbine:
# 被监控服务的spring.application.name
app-config: spring-cloud-consumer
aggregator:
cluster-config: default
cluster-name-expression: new String("default")
instanceUrlSuffix: hystrix.stream
eureka:
client:
service-url:
defaultZone: http://localhost:8765/eureka
启动类
package com.wang.turbine; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import org.springframework.cloud.netflix.turbine.EnableTurbine; @SpringBootApplication @EnableHystrixDashboard @EnableTurbine public class TurbineApplication { public static void main(String[] args) { SpringApplication.run(TurbineApplication.class, args); } }
访问服务
http://localhost:8082/hystrix
输入http://localhost:8082/turbine.stream,点击monitor stream,如下图
效果
测试项目代码
eureka:https://gitee.com/wlyfree/eurekaserver
provider:https://gitee.com/wlyfree/eurekaprovider(可以不下)
consumer:https://gitee.com/wlyfree/eurekaconsumer
turbine:https://gitee.com/wlyfree/turbine
使用
下载后依次启动eureka、provider、consumer、turbine即可~