Hystrix Dashboard是Hystrix的一个组件,Hystrix Dashboard提供一个断路器的监控面板,可以使我们更好的监控服务和集群的状态,仅仅使用Hystrix Dashboard只能监控到单个断路器的状态,实际开发中还需要结合Turbine使用。
1,基于SpringBoot的项目之pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.qi.hystrix</groupId> <artifactId>dashboard</artifactId> <packaging>jar</packaging> <version>1.0</version> <name>dashboard</name> <!-- 配置版本常量 --> <properties> <jdk.version>1.8</jdk.version> <spring.cloud.version>2.0.2.RELEASE</spring.cloud.version> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.6.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.0.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> <version>${spring.cloud.version}</version> </dependency> <!-- hystrix-dashboard --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> <version>${spring.cloud.version}</version> </dependency> <!-- Spring Boot actuator服务监控与管理 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> <version>2.0.6.RELEASE</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>build-info</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
2,基于actuator配置application.yml
server: port: 8080 info: head: head body: body management: endpoints: web: exposure: #加载所有的端点,默认只加载了info、health include: '*' endpoint: health: show-details: always #可以关闭指定的端点 shutdown: enabled: false
3,SpringBoot应用启动
package com.qi.hystrix; import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect; import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableHystrixDashboard public class AppHystrixDashboard extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(AppHystrixDashboard.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(AppHystrixDashboard.class); } @Bean public ServletRegistrationBean hystrixMetricsStreamServlet() { return new ServletRegistrationBean(new HystrixMetricsStreamServlet(), "/hystrix.stream"); } @Bean public HystrixCommandAspect hystrixCommandAspect() { return new HystrixCommandAspect(); } }
4,访问Hystrix Dashboard
浏览器输入http://localhost:8080/hystrix,在仪表盘主页面输入http://localhost:8080/hystrix.stream或http://localhost:8080/actuator/hystrix.stream,然后访问基于HystrixCommand实现的controller即可,图片来源与网上,有解释说明,在此借用一下
相关推荐
spring-cloud-netflix-hystrix-dashboard-2.2.3.RELEASE.jar
springcloud hystrix-dashboard
Hystrix-Dashboard使用 运行nohup java -jar standalone-hystrix-dashboard-1.5.6-all.jar & 浏览器打开http://localhost:7979/hystrix-dashboard/ 输入地址http://localhost/hystrix.stream 先点击 add stream ...
spring-cloud-hystrix-dashboard(包含注册中心、member、hystrix-dashboard配置等).zip 包含配置好的eureka注册中心,member服务生产者、hystrix-dashboard的hystrix配置和仪表盘配置
SpringCloud10-2 Hystrix整合Dashboard教程
Standalone hystrix dashboard that can be started using a single jar and is very lightweight
hystrix的监控可执行的jar包,可以同java -jar 直接运行
hystrix-dashboard-1.5.12及里面各指标详细说明,其中war文件,可直接部署使用。(附带指标说明)
Hystrix-dashboard+turbine-web+说明文档,用于Hystrix项目的监控、多实例的聚合监控
Hystrix Dashboard的使用博文中,优化后的服务消费者和服务提供者,Hystrix Dashboard工程、Turbine工程,以及Eureka Server、父级工程的源代码
本文件是文章 https://blog.csdn.net/u012779110/article/details/104479793 示例代码
hystrix-dashboard 1.5.12, war文件,可直接部署使用。
HystrixDashboard的基础使用
spring cloud hystrix &&dashboard源码解读
spring-cloud-starter-netflix-hystrix-dashboard-2.1.0.RELEASE
主要介绍了SpringCloud Hystrix-Dashboard仪表盘的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
简介Hystrix提供了Hystrix Dashboard来实时监控HystrixCommand方法的执行情况。Hystrix Dashboard可以有效地反映
资源用springcloud搭的一个小框架,涉及Hystrix Dashboard的知识点,适合初学者理解微服务,大神绕过!
java -jar target/hystrix-dashboard-0.0.1.BUILD-SNAPSHOT.jar 在浏览器中,转到 #可在application.yml配置的端口 在主页上是一个表单,您可以在其中输入事件流的URL以进行监视,例如(本地运行的客户服务): ...
针对生产环境, Netflix还给我们准备了一个非常好用的运维工具, 那就是Hystrix Dashboard,通过Hystrix ... 但是只使用Hystrix Dashboard的话, 能看到单个应用内的服务信息,大神必备神器,导入即用,无需更改和配置!