Hystrix的断容器监控dashboard。

dashboard是用来监控Hystrix的断容器监控的,图形化dashboard是如何实现指标的收集展示的。

dashboard

本地端口8730

项目地址:http://localhost:8730/hystrix

在Pom.xml文件引入:

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>

  

在入口文件开启注解

@SpringBootApplication

@EnableHystrixDashboard
@SpringBootApplication
public class FeignApp { public static void main(String[] args) {
SpringApplication.run(FeignApp.class, args);
}
}

  

然后运行,http://localhost:8730/hystrix

Hystrix

本项目地址:http://192.168.1.6:8010

pom.xml加入hystrix引入

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>

  

入口文件引入hystrix注解

@EnableCircuitBreake

@EnableEurekaClient
@SpringBootApplication
//hystrix
@EnableCircuitBreaker
public class HystrixApplication { //ribbon
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
} public static void main(String[] args) {
SpringApplication.run(HystrixApplication.class, args);
}
}

  

Controller文件调用hystrix

@HystrixCommand(fallbackMethod = "notfindback", commandProperties=@HystrixProperty(name="execution.isolation.strategy", value="SEMAPHORE") )

其中fallbackMethod 方法是回退,当网络不通,或者无法访问时访问:notfindback方法,返回默认值

commandProperties是合并线程

@RestController
public class MovieController { @Autowired
private RestTemplate restTemplate; @GetMapping("/movie/{id}")
@HystrixCommand(fallbackMethod = "notfindback", commandProperties=@HystrixProperty(name="execution.isolation.strategy", value="SEMAPHORE") )
public User findById(@PathVariable Long id)
{
//http://localhost:7900/simple/
return restTemplate.getForObject("http://spring-boot-user/simple/" + id, User.class);
} public User notfindback(Long id)
{
User user = new User();
user.setId(0L);
return user; } }

  

访问:

http://192.168.1.6:8010/movie/1

查看hystrix.stream信息

http://192.168.1.6:8010/hystrix.stream

dashboard监控http://192.168.1.6:8010/hystrix.stream信息

在http://localhost:8730/hystrix中输入要监控的hystrix.stream

如下

每当我刷新:http://192.168.1.6:8010/movie/1数据时,http://localhost:8730/hystrix/monitor?stream=http%3A%2F%2F192.168.1.6%3A8010%2Fhystrix.stream 的指示图就发生变化

spring cloud: Hystrix(七):Hystrix的断容器监控dashboard的更多相关文章

  1. Spring Cloud 入门 之 Hystrix 篇(四)

    原文地址:Spring Cloud 入门 之 Hystrix 篇(四) 博客地址:http://www.extlight.com 一.前言 在微服务应用中,服务存在一定的依赖关系,如果某个目标服务调用 ...

  2. Spring Cloud入门教程-Hystrix断路器实现容错和降级

    简介 Spring cloud提供了Hystrix容错库用以在服务不可用时,对配置了断路器的方法实行降级策略,临时调用备用方法.这篇文章将创建一个产品微服务,注册到eureka服务注册中心,然后我们使 ...

  3. Spring Cloud(七):配置中心(Git 版与动态刷新)【Finchley 版】

    Spring Cloud(七):配置中心(Git 版与动态刷新)[Finchley 版]  发表于 2018-04-19 |  更新于 2018-04-24 |  Spring Cloud Confi ...

  4. Spring Cloud(Dalston.SR5)--Hystrix 断路器

    Spring Cloud 对 Hystrix 进行了封装,使用 Hystrix 是通过 @HystrixCommand 注解来使用的,被 @HystrixCommand 注解标注的方法,会使用 Asp ...

  5. Spring cloud微服务 Hystrix熔断器学习教程

    以下demo代码:https://github.com/wades2/HystrixtDemo 官网定义:Hystrix是一个延迟容错库.在分布式环境中,许多服务依赖项中的一些不可避免地会失败.Hys ...

  6. [Spring cloud 一步步实现广告系统] 19. 监控Hystrix Dashboard

    在之前的18次文章中,我们实现了广告系统的广告投放,广告检索业务功能,中间使用到了 服务发现Eureka,服务调用Feign,网关路由Zuul以及错误熔断Hystrix等Spring Cloud组件. ...

  7. Spring Cloud Feign 整合 Hystrix

    在前面随笔Spring Cloud 之 Feign的feign工程基础上进行改造 1.pom.xml依赖不变 2.application.yml文件添加feign.hystrix.enabled=tr ...

  8. Spring Cloud Ribbon 整合 Hystrix

    在前面随笔 Spring Cloud 之 Ribbon 的ribbon工程基础上进行改造 1.pom.xml 加入依赖 <dependency> <groupId>org.sp ...

  9. 架构师入门:Spring Cloud系列,Hystrix与Eureka的整合

    和Ribbon等组件一样,在项目中,Hystrix一般不会单独出现,而是会和Eureka等组件配套出现.在Hystrix和Eureka整合后的框架里,一般会用到Hystrix的断路器以及合并请求等特性 ...

随机推荐

  1. Bitbucket备份恢复

    我们需要备份什么? home directory:contains  repository data, log files, plugins, and so on. database:contains ...

  2. 更改 centos 7的源为 阿里源

    阿里源的网址在这里:http://mirrors.aliyun.com/repo/ 一.进入源文件存放目录 cd /etc/yum.repos.d 二.安装基本源: 1.如果要备份原来的源文件 sud ...

  3. ListView与ArrayAdapter(二)

    ArrayAdapter: 数组适配器,用于简单的文字列表 activity_main.xml <RelativeLayout xmlns:android="http://schema ...

  4. QSetting

    .初始化,判断是否存在ini文件,如果不存在则新建 void iniConfig() { QFileInfo fileInfo(".\\config.ini"); if (!fil ...

  5. topcoder srm 698 div1 -3

    1.定义重复串$S=T+T$,即$S$可以表示成一个串的叠加.给定一个串$s$,可以通过删除字符.修改字符.增加字符来使得其变为重复串.问最少的次数. 思路:首先将$s$分成个串$s_{0},s_{1 ...

  6. MongoDB 创建索引及其他

    索引 以提升查询速度 测试:插入十万条数据到数据库中 for(i=0;i<100000;i++){db.t255.insert({name:'test'+i,age:i})} db.t1.fin ...

  7. CF161D Distance in Tree(点分治)

    点分治是一种处理树的优秀暴力 这是一道板子题 #include <cstdio> #include <cstring> #include <algorithm> u ...

  8. (zhuan) 126 篇殿堂级深度学习论文分类整理 从入门到应用

    126 篇殿堂级深度学习论文分类整理 从入门到应用 | 干货 雷锋网 作者: 三川 2017-03-02 18:40:00 查看源网址 阅读数:66 如果你有非常大的决心从事深度学习,又不想在这一行打 ...

  9. 常用模块(json/pickle/shelve/XML)

    一.json模块(重点) 一种跨平台的数据格式 也属于序列化的一种方式 介绍模块之前,三个问题: 序列化是什么? 我们把对象(变量)从内存中变成可存储或传输的过程称之为序列化. 反序列化又是什么? 将 ...

  10. 51nod 1405 树的距离之和(dfs)

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1405 题意: 思路: 先求出所有点到根节点的距离,需要维护每棵子树的大小 ...