spring-cloud-netflix-hystrix-dashboard
Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数据。
Hystrix Dashboard
我们使用上期spring-cloud-consumer-hystrix工程进行修改,添加hystrix Dashboard功能
添加所需要的依赖:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>lf.liyouyou</groupId>
<artifactId>spring-cloud-netflix-demo</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>lf.liyouyou</groupId>
<artifactId>spring-cloud-consumer-hystrix</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-cloud-consumer-hystrix</name>
<description>Demo project for Spring Boot</description> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<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.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </project>
二、启动类添加注解
package lf.liyouyou; import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean; @SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrixDashboard
@EnableCircuitBreaker
public class SpringCloudConsumerHystrixApplication { public static void main(String[] args) {
SpringApplication.run(SpringCloudConsumerHystrixApplication.class, args);
}
}
三、修改配置:
spring.application.name=spring-cloud-netflix-consumer-hystrix
server.port=9091
eureka.client.service-url.defaultZone=http://localhost:8000/eureka/
feign.hystrix.enabled=true
#默认只开启了health和info,设置为*,则包含所有的web入口端点
management.endpoints.web.exposure.include=*
hystrix.dashboard.proxy-stream-allow-list=*
启动项目,
输入:http://localhost:9091/hystrix 进入如下页面:

注意自己的应用是在本地还是外部,本地用http,不同版本路径不同,2.0版本路径为../actuator/hystrix.stream
输入之后点击 monitor,进入页面

出现 Unable to connect to Command Metric Stream.显示未连接
(1)访问自己的应用服务,http://localhost:9091/actuator/hystrix.stream,显示ping,调用熔断接口http://localhost:9091/hello/lf,返回data

排除的代码、注解、包的问题
(2)查看debug日志,若出现
Proxy opening connection to: http://localhost:9091/actuator/hystrix.stream
WARN 6980 --- [nio-9091-exec-8] ashboardConfiguration$ProxyStreamServlet : Failed opening connection to http://localhost:9091/actuator/hystrix.stream : 404 : HTTP/1.1 404
则需要在application.properties配置中,打开actuator访问
management.endpoints.web.exposure.include=*
(3)查看debug日志,若出现
WARN 9888 --- [nio-9091-exec-3] ashboardConfiguration$ProxyStreamServlet : Origin parameter: http://localhost:9091/actuator/hystrix.stream is not in the allowed list of proxy host names.
If it should be allowed add it to hystrix.dashboard.proxyStreamAllowList.
则需要在application.properties配置中,打开代理访问
hystrix.dashboard.proxy-stream-allow-list=*
重新启动项目,重新访问,进入hystrix面板

访问熔断接口,面板如下

If it should be allowed add it to hystrix.dashboard.proxyStreamAllowList.
则需要在application.properties配置中,打开代理访问
spring-cloud-netflix-consumer-hystrix
spring-cloud-netflix-hystrix-dashboard的更多相关文章
- springcloud学习04- 断路器Spring Cloud Netflix Hystrix
依赖上个博客:https://www.cnblogs.com/wang-liang-blogs/p/12072423.html 1.断路器存在的原因 引用博客 https://blog.csdn.ne ...
- Spring Cloud Netflix Hystrix介绍和使用
前面我们搭建了具有服务降级功能的Hystrix客户端,现在我们来详细了解下Hystrix的一些功能. Hystrix的意思是豪猪,大家都知道,就是长满刺的猪...实际上,它表明了该框架的主要功能:自我 ...
- Spring Cloud Netflix项目进入维护模式
任何项目都有其生命周期,Spring Could Netflix也不例外,官宣已进入维护模式,如果在新项目开始考虑技术选型时要考虑到这点风险,并考虑绕道的可能性. 原创: itmuch IT牧场 这 ...
- spring cloud连载第三篇之Spring Cloud Netflix
1. Service Discovery: Eureka Server(服务发现:eureka服务器) 1.1 依赖 <dependency> <groupId>org.spr ...
- Spring Cloud Netflix概览和架构设计
Spring Cloud简介 Spring Cloud是基于Spring Boot的一整套实现微服务的框架.他提供了微服务开发所需的配置管理.服务发现.断路器.智能路由.微代理.控制总线.全局锁.决策 ...
- 基于Spring Cloud Netflix的TCC柔性事务和EDA事件驱动示例
Solar Spring Cloud为开发者提供了快速构建分布式系统中的一些常见工具,如分布式配置中心,服务发现与注册中心,智能路由,服务熔断及降级,消息总线,分布式追踪的解决方案等. 本次实战以模拟 ...
- Spring Cloud 学习--Hystrix应用
上一篇介绍了Hystrix基本功能和单独使用的方式,今天继续学习如何将Hystrix融入SpringCloud组件中去. 在Ribbon上使用熔断器 在 pom.xml 文件中引入 hystrix 的 ...
- Spring Cloud netflix 概览和架构设计
pring Cloud是基于Spring Boot的一整套实现微服务的框架.他提供了微服务开发所需的配置管理.服务发现.断路器.智能路由.微代理.控制总线.全局锁.决策竞选.分布式会话和集群状态管理等 ...
- spring cloud图形化dashboard是如何实现指标的收集展示的
spring cloud图形化dashboard是如何实现指标的收集展示的 1.dashboard图形化界面入口 http://localhost:10000/hystrix.stream 说明:端口 ...
- 分布式微服务技术之 Spring Cloud Netflix
1 背景 Netflix 是全球十大视频网站中唯一收费站点,是美国互联网流媒体播放商,由于访问量巨大,转型为云计算公司. 由Netflix公司主持开发了一套代码框架和库Netflix OSS即open ...
随机推荐
- guava eventbus 原理+源码分析
前言: guava提供的eventbus可以很方便的处理一对多的事件问题, 最近正好使用到了,做个小结,使用的demo网上已经很多了,不再赘述,本文主要是源码分析+使用注意点+新老版本eventbus ...
- 2021年【线上】第一性原理vasp技术实战培训班
材料模拟分子动力学课程 3月19号--22号 远程在线课 lammps分子动力学课程 3月12号--15号 远程在线课 第一性原理VASP实战课 3月25号-28号 远程在线课 量子化学Gaussia ...
- 图像分类学习:X光胸片诊断识别----迁移学习
引言 刚进入人工智能实验室,不知道是在学习机器学习还是深度学习,想来他俩可能是一个东西,查阅之后才知道这是两个领域,或许也有些交叉,毕竟我也刚接触,不甚了解. 在我还是个纯度小白之时,写下这篇 ...
- [阿里DIEN] 深度兴趣进化网络源码分析 之 Keras版本
[阿里DIEN] 深度兴趣进化网络源码分析 之 Keras版本 目录 [阿里DIEN] 深度兴趣进化网络源码分析 之 Keras版本 0x00 摘要 0x01 背景 1.1 代码进化 1.2 Deep ...
- Canal介绍以及应用
Canal介绍以及应用 应用场景: canal [kə'næl],译意为水道/管道/沟渠,主要用途是基于 MySQL 数据库增量日志解析,提供增量数据订阅和消费 早期阿里巴巴因为杭州和美国双机房部署, ...
- 解读腾讯敏捷研发核心驱动力 腾讯TAPD TAPD 2020-12-17
解读腾讯敏捷研发核心驱动力 腾讯TAPD TAPD 2020-12-17
- LINUX动态库(.SO)搜索路径(目录)设置方法
LINUX动态库(.SO)搜索路径(目录)设置方法 [root@VM_0_11_centos ld.so.conf.d]# cat /etc/ld.so.confinclude ld.so.conf. ...
- 九鼎S5PV210开发板的SD卡启动、uboot tftp升级内核镜像
Note: 我的S5PV210板子的磁盘是emmc版本,不是nandflash版本. 1. SD卡内烧录uboot镜像,然后作为启动盘来启动emmc中的内核镜像和根文件系统. 只要破坏emmc内的ub ...
- MySQL 数据库性能调优
MySQL 数据库性能调优 MySQL性能 最大数据量 最大并发数 优化的范围有哪些 存储.主机和操作系统方面: 应用程序方面: 数据库优化方面: 优化维度 数据库优化维度有四个: 优化选择: 数据库 ...
- navicat连接阿里云mysql数据库服务器遇到的1130等相关问题
最近搭建自己的博客网站的时候使用了阿里云的云服务器ESC,搭建了一个mysql数据库,在windows下使用navicat连接mysql的时候,总是连接不上,出现了1130的问题等等错误信息. 下面将 ...