【第二十五章】 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 ...
随机推荐
- 分布式网格缓存Coherence简介
Coherence企业级缓存(一) 特点 摘要:Oracle Coherence是一个企业级的分布式集群缓存框架.具有自管理,自恢复,高可用性,高扩展性等优良特点,在电信BOSS等项目中有很大的应用价 ...
- wordpress注册后重定向到自定义页面
wordpress注册后重定向到自定义页面怎么操作?将下面的代码添加到当前主题的 functions.php 文件中即可 add_filter( 'registration_redirect', 'w ...
- URAL 1517 Freedom of Choice (后缀数组 输出两个串最长公共子串)
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/whyorwhnt/article/details/34075603 题意:给出两个串的长度(一样长) ...
- 系列解读Dropout
本文主要介绍Dropout及延伸下来的一些方法,以便更深入的理解. 想要提高CNN的表达或分类能力,最直接的方法就是采用更深的网络和更多的神经元,即deeper and wider.但是,复杂的网络也 ...
- CentOS6.5 升级 Python 2.7 版本
转载请注明出处http://write.blog.csdn.net/mdeditor 目录 目录 前言 安装Python-279 解决YUM与Python279的兼容问题 前言 CentOS 6.5中 ...
- Period(sdut2476)
[题目大意]:给定一个字符串,求到哪一位时的字串是前几位循环组成的,并求出循环次数. 思路:求每个前缀的最小循环周:从i到n枚举len,如果len%(len-next[len])==0,则这个前缀是由 ...
- HDU1180:诡异的楼梯(bfs+优先队列)
http://acm.hdu.edu.cn/showproblem.php?pid=1180 Problem Description Hogwarts正式开学以后,Harry发现在Hogwarts里, ...
- EM算法小结
一.什么是EM算法? EM算法是机器学习中一个很重要的算法,即期望最大化算法,主要包括以下两个步骤: E步骤:estimate the expected values M步骤:re-estimate ...
- itertools模块(收藏)
Python的内建模块itertools提供了非常有用的用于操作迭代对象的函数. count().cycle().repeat() 首先,我们看看itertools提供的几个“无限”迭代器: > ...
- pythonon ddt数据驱动二(json, yaml 驱动)
这一篇主要是关于文件的数据驱动. 一.通过json文件驱动 @ddt class MyTest(unittest.TestCase): @file_data('test_data_list.json' ...