Springcloud Circuit Breaker Aggregation monitoring (Hystrix Turbine)

Source: Internet
Author: User

I. Introduction of HYSTRIX turbine
Looking at the individual Hystrix dashboard data does not have much value, want to see this system Hystrix dashboard data need to use Hystrix Turbine. Hystrix Turbine integrates each service Hystrix dashboard data. The use of Hystrix turbine is very simple, just to introduce the appropriate dependencies and add annotations and configuration.

Ii. preparatory work
The project used in this paper is a project of the previous article, which is reformed on this basis. Because we need multiple services dashboard, so need to build a service, named Service-lucy, its basic configuration with Service-hi, the specific source, here is not detailed description.

Iii. creation of Service-turbine
The corresponding dependencies are introduced:

<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> &LT;GROUPID&GT;ORG.SPRINGF Ramework.boot</groupid> <artifactId>spring-boot-starter-actuator</artifactId> &LT;/DEP endency> <dependency> <groupId>org.springframework.cloud</groupId> <a            Rtifactid>spring-cloud-starter-netflix-hystrix</artifactid> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> &LT;ARTIFACTID&GT;SPRING-CLOUD-STARTER-NETF Lix-hystrix-dashboard</artifactid> </dependency> <dependency> <groupid>org.springframework.cloud& Lt;/groupid> <artifactId>spring-cloud-starter-netflix-turbine</artifactId> </dependenc Y> </dependencies>

In its entry class serviceturbineapplication add annotation @enableturbine, open turbine, @EnableTurbine annotations contain @enablediscoveryclient annotations, The registration service is turned on.

@SpringBootApplication@EnableEurekaClient@EnableDiscoveryClient@RestController@EnableHystrix@EnableHystrixDashboard@EnableCircuitBreaker@EnableTurbinepublic class ServiceTurbineApplication {    /**     * http://localhost:8764/turbine.stream     */    public static void main(String[] args) {        SpringApplication.run( ServiceTurbineApplication.class, args );    }}

Configuration file Application.yml:

spring:  application.name: service-turbineserver:  port: 8769security.basic.enabled: falseturbine:  aggregator:    clusterConfig: default   # 指定聚合哪些集群,多个使用","分割,默认为default。可使用http://.../turbine.stream?cluster={clusterConfig之一}访问  appConfig: service-hi,service-la  ### 配置Eureka中的serviceId列表,表明监控哪些服务  clusterNameExpression: new String("default")  # 1. clusterNameExpression指定集群名称,默认表达式appName;此时:turbine.aggregator.clusterConfig需要配置想要监控的应用名称  # 2. 当clusterNameExpression: default时,turbine.aggregator.clusterConfig可以不写,因为默认就是default  # 3. 当clusterNameExpression: metadata[‘cluster‘]时,假设想要监控的应用配置了eureka.instance.metadata-map.cluster: ABC,则需要配置,同时turbine.aggregator.clusterConfig: ABCeureka:  client:    serviceUrl:      defaultZone: http://localhost:8761/eureka/

The configuration file annotations are written clearly. You are welcome to study the relevant technology to understand the source of friends directly seeking exchange and sharing technology: 2147775633

Turbine Demo
Turn on server, Service-hi, Service-la, Service-turbine Engineering.
Open Browser input: Http://localhost:8769/turbine.stream,

Request in turn:

http://localhost:8762/hi?name=whhttp://localhost:8763/hi?name=wh

Open: Http://localhost:8763/hystrix, input monitor stream http://localhost:8769/turbine.stream

You can see that this page aggregates the Hystrix dashbord data for 2 service.

Springcloud Circuit Breaker Aggregation monitoring (Hystrix Turbine)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.