#1.构建一个服务监控模块

##1.1创建模块cloud-consumer-hystrix-dashboard9001

##1.2pom文件依赖

  1. <dependencies>
  2.  
  3. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
  4. <dependency>
  5. <groupId>org.springframework.boot</groupId>
  6. <artifactId>spring-boot-starter-actuator</artifactId>
  7. </dependency>
  8.  
  9. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
  10. <dependency>
  11. <groupId>org.springframework.boot</groupId>
  12. <artifactId>spring-boot-devtools</artifactId>
  13. <scope>runtime</scope>
  14. <optional>true</optional>
  15. </dependency>
  16.  
  17. <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
  18. <dependency>
  19. <groupId>org.projectlombok</groupId>
  20. <artifactId>lombok</artifactId>
  21. <optional>true</optional>
  22. </dependency>
  23.  
  24. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
  25. <dependency>
  26. <groupId>org.springframework.boot</groupId>
  27. <artifactId>spring-boot-starter-test</artifactId>
  28. <scope>test</scope>
  29. </dependency>
  30.  
  31. <!-- hystrix dashboard-->
  32.  
  33. <dependency>
  34. <groupId>org.springframework.cloud</groupId>
  35. <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
  36. </dependency>
  37.  
  38. </dependencies>

##1.3yml文件

  1. server:
  2. port: 9001

##1.4主启动类

  1. package com.atguigu.springcloud;
  2.  
  3. import org.springframework.boot.SpringApplication;
  4. import org.springframework.boot.autoconfigure.SpringBootApplication;
  5. import org.springframework.cloud.netflix.hystrix.EnableHystrix;
  6. import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
  7.  
  8. @SpringBootApplication
  9. @EnableHystrixDashboard
  10. public class HyStrixBoardMain9001 {
  11. public static void main(String[] args) {
  12. SpringApplication.run(HyStrixBoardMain9001.class,args);
  13. }
  14.  
  15. }

##1.5启动

  访问http://localhost:9001/hystrix,看到下图界面,表示搭建成功

  

#2.被监控的服务配置

  我这里有一个8001端口的服务

##2.1加入依赖

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-actuator</artifactId>
  4. </dependency>

##2.2启动类

需加入

  1. //此配置是为了服务监控而配置,和服务容错本身无关,是springcloud审计后的坑
  2. //ServletRegistrationBean因为springboot的默认路径不是/hystrix.stream,需要以下配置
  3. @Bean
  4. public ServletRegistrationBean getServlet(){
  5. HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
  6. ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
  7. registrationBean.setLoadOnStartup(1);
  8. registrationBean.addUrlMappings("/hystrix.stream");
  9. registrationBean.setName("HystrixMetricsStreamServlet");
  10. return registrationBean;
  11. }

完整

  1. package com.atguigu.springcloud;
  2.  
  3. import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
  4. import org.springframework.boot.SpringApplication;
  5. import org.springframework.boot.autoconfigure.SpringBootApplication;
  6. import org.springframework.boot.web.servlet.ServletRegistrationBean;
  7. import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
  8. import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  9. import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
  10. import org.springframework.context.annotation.Bean;
  11.  
  12. @SpringBootApplication
  13. @EnableEurekaClient //标识自己是Eureka客户端(也就是一个服务) - 适用于Eureka
  14. @EnableCircuitBreaker
  15. public class HystrixPaymentMain8001 {
  16. public static void main(String[] args) {
  17. SpringApplication.run(HystrixPaymentMain8001.class,args);
  18. }
  19.  
  20. //此配置是为了服务监控而配置,和服务容错本身无关,是springcloud审计后的坑
  21. //ServletRegistrationBean因为springboot的默认路径不是/hystrix.stream,需要以下配置
  22. @Bean
  23. public ServletRegistrationBean getServlet(){
  24. HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
  25. ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
  26. registrationBean.setLoadOnStartup(1);
  27. registrationBean.addUrlMappings("/hystrix.stream");
  28. registrationBean.setName("HystrixMetricsStreamServlet");
  29. return registrationBean;
  30. }
  31.  
  32. }

#3.监控

##3.1监控8001服务

  在可视化页面输入 http://localhost:8001/hystrix.stream

点击 Monitor Stream,刚开始进入发现显示的是Loading。访问8001服务,使它熔断后,才会出现下图

翻译成中文页面是如下效果

##3.2可视化界面说明

  

springcloud 08 Hystrix图形化DashBoard的更多相关文章

  1. spring cloud图形化dashboard是如何实现指标的收集展示的

    spring cloud图形化dashboard是如何实现指标的收集展示的 1.dashboard图形化界面入口 http://localhost:10000/hystrix.stream 说明:端口 ...

  2. SpringCloud之Hystrix断路器以及dashboard 属性详解

    1.自定义hystrixCommand: https://blog.csdn.net/u012702547/article/details/78032191?utm_source=tuicool&am ...

  3. KONG -- 图形化管理(Kong Dashboard)

    前面安装的 KONG 的版本是社区版的 1.0.2,官方的 KONG Manager 好像只有企业版才提供.在 github 上找了一个开源的图形化管理应用 -- Kong Dashboard (ht ...

  4. Spring-Cloud之Hystrix熔断器-5

    一.在分布式系统中,服务与服务之间的依赖错综复杂,一种不可避免的情况就是某些服务会出现故障,导致依赖于它们的其他服务出现远程调度的线程阻塞 Hystrix是Netflix 公司开源的一个项目,它提供了 ...

  5. SpringCloud学习笔记(五、SpringCloud Netflix Hystrix)

    目录: Hystrix简介 线程隔离:线程池.信号量 服务降级.服务熔断.请求缓存.请求合并 Hystrix完整流程.Hystrix属性值 注解方式实现Hystrix Hystrix Dashboar ...

  6. SpringCloud之Hystrix集群监控turbine仪表盘

    1.引入 在前一节中我们演示了单机模式下Hystrix服务监控Dashboard仪表盘,但是在实际生产中微服务都是集群模式, 为了更接近世界生产,我们在这里也给大家讲一下如何监控集群模式 2.准备工作 ...

  7. JMeter学习-040-JMeter图形化 HTML 报表概要说明

    JMeter 3.0开始支持动态生成图形化 HTML dashboard报告,当前生成报告有一下两种方式: 1.脚本测试执行结束后,即生成HTML测试报告 2.通过之前生成的测试结果,生成HTML测试 ...

  8. Linux下链接数据库图形化工具

    (一).Linux环境下mysql的安装.SQL操作 Linux下安装MySQL (rmp --help) 基本步骤:上传软件->检查当前Linux环境是否已经安装,如发现系统自带的,先卸载-& ...

  9. ROS(indigo) 用于机器人控制的图形化编程工具--code_it robot_blockly

    0 简介: 编程语言有汇编,高级语言,解释语言等,现在图形化编程也越来越流行.图形化编程简单易学.8年前,微软推出了VPL用于机器人程序设计,如Python和JavaScript都可以用图形化框图实现 ...

  10. Nginx filebeat+logstash+Elasticsearch+kibana实现nginx日志图形化展示

    filebeat+logstash+Elasticsearch+kibana实现nginx日志图形化展示   by:授客  QQ:1033553122   测试环境 Win7 64 CentOS-7- ...

随机推荐

  1. 自学 TypeScript 第一天 环境开发配置 及 TS 基本类型声明

    前言:  自学第一天,什么是TS ,为什么要用 TS TS 全程 Typed JavaScript at Any Scale 解释起来就是 添加了类型系统的 JavaScript, 是 JavaScr ...

  2. golang 简书

    https://www.jianshu.com/p/548adff0d10d Go 入门指南 https://github.com/wuxiaoxiaoshen/go-example-for-live ...

  3. vcenter密码设置永不过期

    由于机房断电,原本的vcenter重启后web页面出现报错,为尽快恢复vcenter管理机,直接停用了旧的vcenter虚机,重新安装了一台vcenter,两个月后,页面开始报警密码即将到期: 经查阅 ...

  4. VMware 虚拟机打开电源失败

    vmware上虚拟机关机导出ovf失败后,再次启动虚拟机,突然无法打开虚拟机,并伴随如下报错: 模块"disk"打开电源失败,无法打开磁盘/***/.../***.vmdk 解决方 ...

  5. 抓包整理————ip 协议四[十五]

    前言 简单了解一下ip 协议选路问题. 正文 比如host1 到 host2是直接传输,因为host1和 host2 是同一交换机,直接arp表知道对方的mac. 第二种是他们是不同网段之间通信. 第 ...

  6. 解决mysql本地连接速度慢

    解决方法 用127.0.0.1而不用localhost 原因 听说是有什么DNS的反向解析

  7. 关于linux建立u盘legacy启动方式引导

    前言 我一直在用linux,但是我在linux制作pe启动盘无法实现,windows有很多制作pe启动盘的软件,如大白菜,u深度什么的,但是linux没有对应的软件,所以我想写一个类似的工具,那么就有 ...

  8. 关于windows上开启远程桌面连接不上的问题解决

    解决办法 启用远程桌面连接(计算机-属性-远程设置) 选择第二个:允许运行任意版本远程桌面 关闭防火墙(或者给远程桌面添加端口3389放行也可以) 创建用户以及密码 这里注意,一定要建立密码,只有账号 ...

  9. oracle 内置函数(二)字符函数

    主要函数: 大小写转换函数 获取子字符串函数(字符串截取) 获取字符串长度函数 字符串连接函数 去除子字符串函数 字符替换函数 字符串出现次数 字符串按照特定符号拆分多行 一.大小写转换 1.uppe ...

  10. 使用Supervisor监控mysql

    Supervisor安装教程参考:https://www.cnblogs.com/brad93/p/16639953.html mysql安装教程参考:https://www.cnblogs.com/ ...