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:
1234567891011121314151617181920
<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.
1234567
@EnableHystrixDashboard @SpringCloudApplication public class hystrixdashboardapplication {public static void Main (string[] args) {     Springapplication.run (Hystrixdashboardapplication.class, args);}}
    • Modify the configuration file according to the actual situation application.properties , such as: Select an unoccupied port, etc., this step is not necessary.
12
spring.application.name=hystrix-dashboardserver.port=1301

Since the Hystrix dashboard monitoring Single instance node needs to be implemented by accessing the interface of the instance, /hystrix.stream 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:

    • pom.xmlAdd a monitoring module to the node in the service instance dependencies spring-boot-starter-actuator to turn on the monitoring-related endpoint and ensure that the circuit-breaker dependency has been introduced spring-cloud-starter-hystrix :
12345678
 
<DEPENDENCY> <groupid>org.springframework.cloud</ GROUPID> <artifactid>spring-cloud-starter-hystrix</< Span class= "name" >ARTIFACTID> </ Dependency> <DEPENDENCY> <groupid>org.springframework.boot</ GROUPID> <artifactid>spring-boot-starter-actuator</< Span class= "name" >ARTIFACTID> </ Dependency>
    • Make sure that the breaker function is turned on by using or annotating the main class of the service instance @EnableCircuitBreaker @EnableHystrix .

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.