1.在platform文件夹下创建模块hystrix-turbine
2.pom依赖配置
eureka-client 、 hystrix 、 turbine
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>foodie-cloud</artifactId>
<groupId>com.imooc</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hystrix-turbine</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.imooc.item.HystrixTurbineApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
3.创建包com/imooc
4.创建HystrixTurbineApplication
@EnableDiscoveryClient
@EnableTurbine
@EnableAutoConfiguration
############################################################
#
# Eureka注册中心
#
############################################################
eureka:
client:
serviceUrl:
defaultZone: http://localhost:20000/eureka/
server:
port: 20001
management:
server:
port: 52001
spring:
application:
name: hystrix-turbine
turbine:
aggregator:
clusterConfig: default
app-config: foodie-order-service
#集群的名称叫default
cluster-name-expression: "default"
#使用host+port的形式组合进行区分
combine-host-port: true
#从哪个actuator的端点拉取方法调用信息
instanceUrlSuffix:
default:actuator/hystix.stream