How to monitor the aggregation of circuit breakers in Spring Cloud
Spring Cloud how breaker aggregation monitoring, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.
I. Preparations
A similar transformation of the previous project service-feign.
Second, the new maven project service_turbine
1. New pom.xml
4.0.0 wg service_turbine 0.0.1-SNAPSHOT jar service_turbine http://maven.apache.org UTF-8 UTF-8 Greenwich.RELEASE 1.8 org.springframework.boot spring-boot-starter-parent 2.1.1.RELEASE org.springframework.boot spring-boot-starter-actuator org.springframework.cloud spring-cloud-starter-netflix-hystrix org.springframework.cloud spring-cloud-starter-netflix-hystrix-dashboard org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-web org.springframework.cloud spring-cloud-starter-openfeign org.springframework.cloud spring-cloud-starter-netflix-turbine junit junit test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import
2. Create ServiceTurbineApplication.java
package wg;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;import org.springframework.cloud.client.discovery.EnableDiscoveryClient;import org.springframework.cloud.netflix.eureka.EnableEurekaClient;import org.springframework.cloud.netflix.hystrix.EnableHystrix;import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;import org.springframework.cloud.netflix.turbine.EnableTurbine;import org.springframework.cloud.openfeign.EnableFeignClients;@SpringBootApplication@EnableEurekaClient@EnableDiscoveryClient@EnableFeignClients@EnableHystrix@EnableHystrixDashboard@EnableCircuitBreaker@EnableTurbinepublic class ServiceTurbineApplication { public static void main(String[] args) { SpringApplication.run( ServiceTurbineApplication.class, args ); }}
3. Create a new application.yml
server: port: 8767spring: application: name: service-turbineeureka: client: serviceUrl: defaultZone: http://localhost1:8761/eureka/,http://localhost2:8861/eureka/management: endpoints: web: exposure: include: "*" cors: allowed-origins: "*" allowed-methods: "*"turbine: app-config: service-feign,service-ribbon aggregator: clusterConfig: default clusterNameExpression: new String("default") combine-host: true instanceUrlSuffix: default: actuator/hystrix.stream
4. Start the project, visit: turbine.stream
5. Visit: http://localhost:8764/hystrix, fill in the content
6. Click Monitor and visit http://localhost:8765/hello, http://localhost:8764/hello
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.