spring cloud: Hystrix(七):Hystrix的断容器监控dashboard
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的更多相关文章
- Spring Cloud 入门 之 Hystrix 篇(四)
原文地址:Spring Cloud 入门 之 Hystrix 篇(四) 博客地址:http://www.extlight.com 一.前言 在微服务应用中,服务存在一定的依赖关系,如果某个目标服务调用 ...
- Spring Cloud入门教程-Hystrix断路器实现容错和降级
简介 Spring cloud提供了Hystrix容错库用以在服务不可用时,对配置了断路器的方法实行降级策略,临时调用备用方法.这篇文章将创建一个产品微服务,注册到eureka服务注册中心,然后我们使 ...
- Spring Cloud(七):配置中心(Git 版与动态刷新)【Finchley 版】
Spring Cloud(七):配置中心(Git 版与动态刷新)[Finchley 版] 发表于 2018-04-19 | 更新于 2018-04-24 | Spring Cloud Confi ...
- Spring Cloud(Dalston.SR5)--Hystrix 断路器
Spring Cloud 对 Hystrix 进行了封装,使用 Hystrix 是通过 @HystrixCommand 注解来使用的,被 @HystrixCommand 注解标注的方法,会使用 Asp ...
- Spring cloud微服务 Hystrix熔断器学习教程
以下demo代码:https://github.com/wades2/HystrixtDemo 官网定义:Hystrix是一个延迟容错库.在分布式环境中,许多服务依赖项中的一些不可避免地会失败.Hys ...
- [Spring cloud 一步步实现广告系统] 19. 监控Hystrix Dashboard
在之前的18次文章中,我们实现了广告系统的广告投放,广告检索业务功能,中间使用到了 服务发现Eureka,服务调用Feign,网关路由Zuul以及错误熔断Hystrix等Spring Cloud组件. ...
- Spring Cloud Feign 整合 Hystrix
在前面随笔Spring Cloud 之 Feign的feign工程基础上进行改造 1.pom.xml依赖不变 2.application.yml文件添加feign.hystrix.enabled=tr ...
- Spring Cloud Ribbon 整合 Hystrix
在前面随笔 Spring Cloud 之 Ribbon 的ribbon工程基础上进行改造 1.pom.xml 加入依赖 <dependency> <groupId>org.sp ...
- 架构师入门:Spring Cloud系列,Hystrix与Eureka的整合
和Ribbon等组件一样,在项目中,Hystrix一般不会单独出现,而是会和Eureka等组件配套出现.在Hystrix和Eureka整合后的框架里,一般会用到Hystrix的断路器以及合并请求等特性 ...
随机推荐
- 【Python023/024--递归】
一.递归--汉诺塔 1.有三个轴(x,y,z),64个盘子,把所有盘子从X轴移动到Z轴,要求移动到Z轴的盘子从上到下排序 思路: 问题一:将X上的63个盘子借助Z移动到Y上,拆解为: a.将前62个盘 ...
- topcoder srm 687 div1
1.$A_{1}=2,A_{2}=3,A_{n}=A_{n-2}+A_{n-1}-1$.给出数字$n$,将其表示成若干个$A$中的不同元素的和. 思路:设$B_{n}=A_{n}-1$,那么有$B_{ ...
- 第一次参加acm区域赛
什么,这周天就要去参加acm焦作赛,简直不敢相信.从大一暑假七月份中旬到今天十一月23日,加入acm将近四个多月的时间,如今到了检验自己的时候了.aaaaaaaaaa.乌拉,必胜.打印个模板,在跑个步 ...
- dede的应用
gbk和utf-8版本选择 gbk是国家编码,所有的内容编码,包括中文,英文,英文字符都占两个字节. utf-8是国际编码,中文三个字节,英文1个字节 现阶段,网站都用gbk编码, 一方面节省本地/网 ...
- 轻重搭配|计蒜客2019蓝桥杯省赛 B 组模拟赛(一)
样例输入: 6 1 9 7 3 5 5 样例输出: 4 思路:贪心,选错贪心思路,只能过一小部分数据,正确贪心思路:从前一半遍历,在后一半中找到比当前元素的两倍大的数(因为这里指针不会后移,所以可以采 ...
- Python, pandas: how to sort dataframe by index// Merge two dataframes by index
pd.concat([df1, df2], axis=1) df.sort_index(inplace=True) https://stackoverflow.com/questions/404680 ...
- 题解——牛客网OI赛制测试赛2
T1 规律题 考虑先全部选中再去重即可 #include <cstdio> #include <algorithm> #include <cstring> #inc ...
- (转) 机器学习很有趣Part6:怎样使用深度学习进行语音识别
本文转自:http://www.jiqizhixin.com/article/2321 机器学习很有趣Part6:怎样使用深度学习进行语音识别 2017-02-19 13:20:47 机器学习 ...
- UVA 11019 Matrix Matcher(哈希)
题意 给定一个 \(n\times m\) 的矩阵,在给定一个 \(x\times y\) 的小矩阵,求小矩阵在大矩阵中出现的次数. \(1 \leq n,m \leq 1000\) \(1\leq ...
- Thread类的常用方法
String getName() 返回该线程的名称. void setName(String name) 改变线程名称,使之与参数 name 相同. int getPriority() 返回线程的优先 ...