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@SpringBootApplicationpublic class TurbineApplication { public static void main(String[] args) { SpringApplication.run(TurbineApplication.class, args); }}
server: port: 8031 #http://localhost:8031/turbine.streamspring: application: name: microservice-hystrix-turbine#turbine加入eurekaeureka: client: serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true #turbine加入eurekaturbine: aggregator: clusterConfig: default #监控ribbon-with-hystrix集群(多个端口)和feign-with-hystrix集群(多个状态) appConfig: microservice-consumer-movie-ribbon-with-hystrix2,microservice-consumer-movie-feign-with-hystrix clusterNameExpression: "'default'"
4.0.0 com.itmuch.cloud microservice-spring-cloud 0.0.1-SNAPSHOT microservice-hystrix-turbine jar UTF-8 org.springframework.cloud spring-cloud-starter-turbine
turbine2的yml文件
server: port: 8031spring: application: name: microservice-hystrix-turbineeureka: client: serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: trueturbine: 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.streamlogging: level: root: INFO com.netflix.turbine.monitor: DEBUG
turbine3的yml文件
server: port: 8031spring: application: name: microservice-hystrix-turbineeureka: client: serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: trueturbine: 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-hystrix2server: 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: /ribbonhystrix.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: 8081spring: application: name: microservice-consumer-movie-ribbon-with-hystrix3server: port: 8010 #访问端口 context-path: /ribboneureka: client: healthcheck: enabled: true serviceUrl: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: true metadata-map: management.port: 8081hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000