Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,提供了数据监控和友好的图形化界面。通过Hystrix Dashboard可以直观地看到Hystrix的各项指标信息。通过Hystrix Dashboard反馈的实时信息,可以帮助我们快速发现系统中存在的问题。
Spring Cloud Hystrix Dashboard的底层原理是间隔一定时间去“Ping”目标服务,返回的结果是最新的监控数据,最后将数据显示出来。
Hystrix Dashboard监控单实例节点需要通过访问实例的/hystrix.stream端点来实现的,所以需要为服务实例添加这个端点。
为服务消费者工程添加/hystrix.stream端点
在pom.xml文件添加以下依赖:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency>
在启动类定义 ServletRegistrationBean 对象,配置hystix.stream端点
/** * SpringBoot2+版本需要手动配置hystrix.stream端点 */ @Bean public ServletRegistrationBean getServlet() { HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("hystrixMetricsStreamServlet"); return registrationBean; }
在浏览器访问hystix.stream端点,查看监控的指标信息
http://localhost:9003/hystrix.stream
创建Hystrix DashBoard监控工程
pom.xml文件关键配置:
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.7.RELEASE</version> <relativePath/> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Finchley.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
启动类
添加@EnableHystrixDashboard注解
@SpringBootApplication @EnableHystrixDashboard //启用Hystrix Dashboard功能 public class Main { public static void main(String[] args) { SpringApplication.run(Main.class, args); } }
application.properties文件的配置
spring.application.name=hystrix-dashboard server.port=6001
运行该工程,在浏览器访问 http://localhost:6001/hystrix ,即可看到Hystrix Dashboard主界面
在主界面上输入一个服务消费者的hystix.stream端点地址,点击“Monitor Stream”按钮进行实时监控。仅使用Hystrix Dashboard只能监控到单个断路器的状态。
监控页面详细说明如下图所示:
相关推荐
Hystrix Dashboard的使用博文中,优化后的服务消费者和服务提供者,Hystrix Dashboard工程、Turbine工程,以及Eureka Server、父级工程的源代码
Hystrix-Dashboard使用 运行nohup java -jar standalone-hystrix-dashboard-1.5.6-all.jar & 浏览器打开http://localhost:7979/hystrix-dashboard/ 输入地址http://localhost/hystrix.stream 先点击 add stream ...
简介Hystrix提供了Hystrix Dashboard来实时监控HystrixCommand方法的执行情况。Hystrix Dashboard可以有效地反映
HystrixDashboard的基础使用
springcloud hystrix-dashboard
SpringCloud -Hystrix监控面板及数据聚合(Turbine)介绍与使用示例 今天我们就将讲解下Hystrix Dashboard和Turbine.其中Hystrix Dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观...
Hystrix-dashboard+turbine-web+说明文档,用于Hystrix项目的监控、多实例的聚合监控
hystrix-dashboard-1.5.12及里面各指标详细说明,其中war文件,可直接部署使用。(附带指标说明)
spring cloud hystrix &&dashboard源码解读
hystrix的监控可执行的jar包,可以同java -jar 直接运行
Standalone hystrix dashboard that can be started using a single jar and is very lightweight
spring-cloud-netflix-hystrix-dashboard-2.2.3.RELEASE.jar
spring-cloud-hystrix-dashboard(包含注册中心、member、hystrix-dashboard配置等).zip 包含配置好的eureka注册中心,member服务生产者、hystrix-dashboard的hystrix配置和仪表盘配置
资源用springcloud搭的一个小框架,涉及Hystrix Dashboard的知识点,适合初学者理解微服务,大神绕过!
SpringCloud10-2 Hystrix整合Dashboard教程
主要介绍了SpringCloud之熔断监控Hystrix Dashboard的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
主要介绍了springcloud 熔断监控Hystrix Dashboard和Turbine,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
本文件是文章 https://blog.csdn.net/u012779110/article/details/104479793 示例代码
主要介绍了SpringCloud Hystrix-Dashboard仪表盘的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
hystrix-dashboard 1.5.12, war文件,可直接部署使用。