package com.itmuch.cloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.turbine.EnableTurbine; //一个turbine server就写完了 //turbine是监控整个集群的, @EnableTurbine @SpringBootApplication public class TurbineApplication { public static void main(String[] args) { SpringApplication.run(TurbineApplication.class, args); } }
server: port: 8031 #http://localhost:8031/turbine.stream spring: application: name: microservice-hystrix-turbine #turbine加入eureka eureka: client: serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true #turbine加入eureka turbine: aggregator: clusterConfig: default #监控ribbon-with-hystrix集群(多个端口)和feign-with-hystrix集群(多个状态) appConfig: microservice-consumer-movie-ribbon-with-hystrix2,microservice-consumer-movie-feign-with-hystrix clusterNameExpression: "'default'"
<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>
<parent>
<groupId>com.itmuch.cloud</groupId>
<artifactId>microservice-spring-cloud</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>microservice-hystrix-turbine</artifactId>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- turbine的依赖 -->
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>
</dependencies>
</project>
turbine2的yml文件
server: port: 8031 spring: application: name: microservice-hystrix-turbine eureka: client: serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true turbine: aggregator: clusterConfig: MICROSERVICE-CONSUMER-MOVIE-RIBBON-WITH-HYSTRIX2 appConfig: microservice-consumer-movie-ribbon-with-hystrix2 turbine.instanceUrlSuffix.MICROSERVICE-CONSUMER-MOVIE-RIBBON-WITH-HYSTRIX2: /ribbon/hystrix.stream logging: level: root: INFO com.netflix.turbine.monitor: DEBUG
turbine3的yml文件
server: port: 8031 spring: application: name: microservice-hystrix-turbine eureka: client: serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true turbine: aggregator: clusterConfig: MICROSERVICE-CONSUMER-MOVIE-RIBBON-WITH-HYSTRIX3 appConfig: microservice-consumer-movie-ribbon-with-hystrix3 logging: level: root: INFO com.netflix.turbine.monitor: DEBUG
microservice-consumer-movie-ribbon-with-hystrix2的yml文件
spring: application: name: microservice-consumer-movie-ribbon-with-hystrix2 server: port: 8010 context-path: /ribbon #url的前缀 eureka: client: healthcheck: enabled: true serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true home-page-url-path: /ribbon hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000 #http://localhost:8761/eureka/apps/microservice-consumer-movie-ribbon-with-hystrix2
microservice-consumer-movie-ribbon-with-hystrix3的yml文件
#一个应用有2个端口,一个管理端口一个访问端口 management: # spring-boot-starter-acturator管理端口 port: 8081 spring: application: name: microservice-consumer-movie-ribbon-with-hystrix3 server: port: 8010 #访问端口 context-path: /ribbon eureka: client: healthcheck: enabled: true serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true metadata-map: management.port: 8081 hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000