【第二十五章】 springboot + hystrixdashboard
注意:
- hystrix基本使用:第十九章 springboot + hystrix(1)
- hystrix计数原理:附6 hystrix metrics and monitor
一、hystrixdashboard
作用:
- 监控各个hystrixcommand的各种值。
- 通过dashboards的实时监控来动态修改配置,直到满意为止
仪表盘:

二、启动hystrix
1、下载standalone-hystrix-dashboard-1.5.3-all.jar
- https://github.com/kennedyoliveira/standalone-hystrix-dashboard:该页面提供了一个很好的视频教学。
2、启动hystrix-dashboard
java -jar -DserverPort=7979 -DbindAddress=localhost standalone-hystrix-dashboard-1.5.3-all.jar- 注意:其中的serverPort、bindAddress是可选参数,若不添加,默认是7979和localhost
3、测试
- 浏览器输入http://localhost:7979/hystrix-dashboard/,出现小熊页面就是正确了。
三、代码
1、pom.xml
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
<version>1.4.10</version>
</dependency>
<!-- http://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-metrics-event-stream -->
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-metrics-event-stream</artifactId>
<version>1.4.10</version>
</dependency>
说明:
- hystrix-core:hystrix核心接口包
- hystrix-metrics-event-stream:只要客户端连接还连着,hystrix-metrics-event-stream就会不断的向客户端以text/event-stream的形式推送计数结果(metrics)
2、配置HystrixMetricsStreamServlet
package com.xxx.firstboot.hystrix.dashboard;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
@Configuration
public class HystrixConfig {
@Bean
public HystrixMetricsStreamServlet hystrixMetricsStreamServlet(){
return new HystrixMetricsStreamServlet();
}
@Bean
public ServletRegistrationBean registration(HystrixMetricsStreamServlet servlet){
ServletRegistrationBean registrationBean = new ServletRegistrationBean();
registrationBean.setServlet(servlet);
registrationBean.setEnabled(true);//是否启用该registrationBean
registrationBean.addUrlMappings("/hystrix.stream");
return registrationBean;
}
}
说明:以上方式是springboot注入servlet并进行配置的方式。
四、测试

说明:启动服务后,输入localhost:8001/hystrix.stream,之后点击"Add Stream",最后点击"Monitor Stream"即可。

说明:
- getHotelInfo - commandKey(其实就是servicename下的一个方法)
- hotelService - ThreadPoolKey(不配置的情况下就是commandGroupKey,其实就是servicename)
【第二十五章】 springboot + hystrixdashboard的更多相关文章
- 第二十五章 springboot + hystrixdashboard
注意: hystrix基本使用:第十九章 springboot + hystrix(1) hystrix计数原理:附6 hystrix metrics and monitor 一.hystrixdas ...
- Gradle 1.12用户指南翻译——第二十五章. Scala 插件
其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Github上的地址: https://g ...
- “全栈2019”Java多线程第二十五章:生产者与消费者线程详解
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java多 ...
- “全栈2019”Java第二十五章:流程控制语句中循环语句while
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...
- 第二十九章 springboot + zipkin + mysql
zipkin的数据存储可以存在4个地方: 内存(仅用于测试,数据不会持久化,zipkin-server关掉,数据就没有了) 这也是之前使用的 mysql 可能是最熟悉的方式 es Cassandra ...
- SpringBoot | 第二十五章:日志管理之自定义Appender
前言 前面两章节我们介绍了一些日志框架的常见配置及使用实践.一般上,在开发过程中,像log4j2.logback日志框架都提供了很多Appender,基本上可以满足大部分的业务需求了.但在一些特殊需求 ...
- 【第二十六章】 hystrix-dashboard + turbine
一.使用turbine的意义 引入多个hystrix stream: 1.使用hystrix-dashboard的可以添加多个stream的功能 图中添加的两个stream会在真正monitor的时候 ...
- C#图解教程 第二十五章 其他主题
其他主题 概述字符串使用 StringBuilder类把字符串解析为数据值关于可空类型的更多内容 为可空类型赋值使用空接合运算符使用可空用户自定义类型 Main 方法文档注释 插入文档注释使用其他XM ...
- 第二十四章 springboot注入servlet
问:有了springMVC,为什么还要用servlet?有了servlet3的注解,为什么还要使用ServletRegistrationBean注入的方式? 使用场景:在有些场景下,比如我们要使用hy ...
随机推荐
- [.NET]解决EMF图像自动放大空白
在.NET中产生emf主要使用Metafile对象,但在使用过程中会发生图像自动放大,多余空白的问题. 模拟:声明Size(100,100)的区域,并绘制p1(-50,-50)->p2(50,5 ...
- 深入浅出 TCP/IP 协议栈
写的不错:http://www.cnblogs.com/onepixel/p/7092302.html#3899256
- LeetCode-206.ReverseLinked List
Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4-> ...
- idong常用js总结
1.判断屏幕高度 $(document).ready(function() { $("#left").height($(window).height()); $(&qu ...
- 混淆矩阵在Matlab中PRtools模式识别工具箱的应用
声明:本文用到的代码均来自于PRTools(http://www.prtools.org)模式识别工具箱,并以matlab软件进行实验. 混淆矩阵是模式识别中的常用工具,在PRTools工具箱中有直接 ...
- Spark中的Spark Shuffle详解
Shuffle简介 Shuffle描述着数据从map task输出到reduce task输入的这段过程.shuffle是连接Map和Reduce之间的桥梁,Map的输出要用到Reduce中必须经过s ...
- Andrew Ng-ML-第十八章-大规模机器学习
1.学习大数据集 图1.学习大数据集 当数据集量为m=1亿时,进行梯度下降将会花费较大时间. 可以使用小量数据集进行训练,然后得出学习曲线. 左图是高方差,右图是高偏差. 总之是要通过高效的学习算法来 ...
- 如何给Pycharm加上头行 # *_*coding:utf-8 *_*?
File>Setting>Editor>Code Style>File and Code Templates>Python Script 后面加上 # *_*codin ...
- Locust性能测试3-no-web模式和csv报告保存
前言 前面是在web页面操作,需要手动的点start启动,结束的时候也需要手工去点stop,没法自定义运行时间,这就不太方便. locust提供了命令行运行的方法,不启动web页面也能运行,这就是no ...
- Intermediate Python for Data Science learning 1 - Basic plots with matplotlib
Basic plots with matplotlib from:https://campus.datacamp.com/courses/intermediate-python-for-data-sc ...