Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor the aggregation of circuit breakers in Spring Cloud

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report