Spring Cloud builds a microservices architecture Hystrix monitoring Panel

Source: Internet
Author: User

Building a Hystrix dashboard in spring cloud is very simple and requires only the following four steps:

Create a standard spring boot project named: Hystrix-dashboard.
Edit Pom.xml, depending on the content as follows:

<parent><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-parent</artifactId><version>Dalston.SR1</version><relativePath /></parent><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-hystrix</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-hystrix-dashboard</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency></dependencies>

To apply the main class plus @enablehystrixdashboard, enable the Hystrix dashboard feature.

@EnableHystrixDashboard@SpringCloudApplicationpublic class HystrixDashboardApplication {public static void main(String[] args) {SpringApplication.run(HystrixDashboardApplication.class, args);}}

Modify the Application.properties configuration file according to the actual situation, such as: Select an unoccupied port, etc., this step is not required.

spring.application.name=hystrix-dashboardserver.port=1301

Since the Hystrix dashboard monitoring Single instance node needs to be implemented by accessing the/hystrix.stream interface of the instance, naturally we need to add this endpoint for the service instance, and the steps to add that feature are just as simple as the following two steps:

Add a Spring-boot-starter-actuator monitoring module to the Dependencies node in the service instance Pom.xml to turn on the monitoring-related endpoint and ensure that the dependency Spring-cloud-starter-hystrix for the circuit breaker has been introduced:

<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-hystrix</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency>

Ensure that the @enablecircuitbreaker or @enablehystrix annotations have been used in the main class of the service instance to turn on the circuit breaker function.
All the configurations have been completed, the "Eureka-consumer-ribbon-hystrix" monitoring has been initiated and the "Monitor Stream" button has been clicked.

From now on, I will record the process and the essence of the recently developed Springcloud micro-service cloud architecture, and help more friends who are interested in developing the Spring cloud framework, hoping to help more good scholars. Let's explore how the Spring cloud architecture is built and how it can be used in enterprise projects.

Spring Cloud builds a microservices architecture Hystrix monitoring Panel

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.