2018-09-05 17:29:40.0|分类: spring cloud|浏览量: 2626
上一节里面,我们使用 Hystrix Dashboard, 只能看到单个应用内的服务信息。在生产环境下,我们经常是集群状态,所以我们就要用到 Turbine 这个应用。 TurbineApp.java package com.cookqq.turbine; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.turbine.EnableTurbine; /** * Hello world! * */ @SpringBootApplication @EnableTurbine public class TurbineApp { public static void main( String[] args ) { SpringApplication.run(TurbineApp.class, args); } } application.yml server: port: 8031 spring: application: name: turbine eureka: client: serviceUrl: defaultZone: http://localhost:8761/eureka/ instance: prefer-ip-address: true turbine: appConfig: consumer-order,consumer-order-feign clusterNameExpression: "'default'" pom.xml <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"> <modelVersion>4.0.0</modelVersion> <groupId>com.cookqq</groupId> <artifactId>turbine</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>turbine</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-turbine</artifactId> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <!-- 引入spring cloud的依赖 --> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Edgware.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> </project> 启动euraka 启动provider-user 启动consumer-order 启动consumer-order-feign 启动turbine 启动hystrix-dashboard 访问consumer-order项目,http://localhost:8080/user/1 访问consumer-order-feign项目,http://localhost:8089/user/1 访问hystrix-dashboard,http://localhost:8088/hystrix 输入http://localhost:8031/turbine.stream |