spring cloud:HystrixDashboard
hystrix-dashboard-server
1. File-->new spring starter project
2.add dependency
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
3.Edit application.yml
server:
port: spring:
application:
name: hystrix-dashboard-server #
#eureka:
# client:
# service-url:
# defaultZone: http://localhost:8761/eureka/
4.program
package com.smile; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean; import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; @SpringBootApplication
@EnableHystrixDashboard
public class HystrixDashboardServerApplication { public static void main(String[] args) {
SpringApplication.run(HystrixDashboardServerApplication.class, args);
} }
5.Run
visit : http://localhost:9000/hystrix 
输入要监控的地址 http://localhost:9001/actuator/hystrix.stream 点击 monitor

hystrix-dashboard-client
1. File-->new spring starter project
2.add dependency
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>
spring-cloud-starter-netflix-hystrix
</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
3.Edit application.yml
server:
port:
spring:
application:
name: hystrix-dashboard-client eureka:
client:
service-url:
defaulZone: http://localhost:8761/eureka/ management:
endpoints:
web:
exposure:
include: '*' feign:
hystrix:
enabled: true
4.program
package com.smile; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableCircuitBreaker //开启断路器,否则监控不到
public class HystrixDashboardClientApplication { public static void main(String[] args) {
SpringApplication.run(HystrixDashboardClientApplication.class, args);
} }
package com.smile.controller; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import com.smile.remote.HelloService; @RestController
public class ConsumerController { @Autowired
HelloService helloService; @RequestMapping("/hello/{name}")
public String helloConsumer(@PathVariable("name") String name) {
return helloService.getHello(name);
} }
package com.smile.remote; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; @FeignClient(name = "producer",fallback = HelloServiceHystrix.class)
public interface HelloService { @RequestMapping("/getHello")
public String getHello(@RequestParam String name);
}
package com.smile.remote; import org.springframework.stereotype.Component; @Component
public class HelloServiceHystrix implements HelloService{ @Override
public String getHello(String name) {
return "hello "+name+",this is hystrix!";
} }
5.Run
visit: http://localhost:9001/hello/smile
hello smile
停止producer 再次访问 http://localhost:9001/hello/smile
hello smile,this is hystrix!
监控也会监控到hystrix

hystrix-dashboard 就到这里了
spring cloud:HystrixDashboard的更多相关文章
- spring cloud 学习研究- spring-cloud-microservice-example
spring cloud + docker 微服务架构 http://www.open-open.com/lib/view/open1437363835818.html 实例项目 https://gi ...
- 【译文】用Spring Cloud和Docker搭建微服务平台
by Kenny Bastani Sunday, July 12, 2015 转自:http://www.kennybastani.com/2015/07/spring-cloud-docker-mi ...
- 从架构演进的角度聊聊Spring Cloud都做了些什么?
Spring Cloud作为一套微服务治理的框架,几乎考虑到了微服务治理的方方面面,之前也写过一些关于Spring Cloud文章,主要偏重各组件的使用,本次分享主要解答这两个问题:Spring Cl ...
- 玩转Spring Cloud之熔断降级(Hystrix)与监控
本文内容导航目录: 前言:解释熔断降级一.搭建服务消费者项目,并集成 Hystrix环境 1.1.在POM XML中添加Hystrix依赖(spring-cloud-starter-netflix-h ...
- Spring Cloud Alibaba基础教程:使用Sentinel实现接口限流
最近管点闲事浪费了不少时间,感谢网友libinwalan的留言提醒.及时纠正路线,继续跟大家一起学习Spring Cloud Alibaba. Nacos作为注册中心和配置中心的基础教程,到这里先告一 ...
- Spring Cloud项目之断路器集群监控Hystrix Dashboard
微服务(Microservices Architecture)是一种架构风格,一个大型复杂软件应用由一个或多个微服务组成.系统中的各个微服务可被独立部署,各个微服务之间是松耦合的.每个微服务仅关注于完 ...
- Spring Cloud 2-Hystrix DashBoard仪表盘(五)
Spring Cloud Hystrix DashBoard 1.监控系统配置 pom.xml application.yml Application.java 2.被监控服务配置 pom.xml ...
- Spring Cloud 微服务架构全链路实践
阅读目录: 1. 网关请求流程 2. Eureka 服务治理 3. Config 配置中心 4. Hystrix 监控 5. 服务调用链路 6. ELK 日志链路 7. 统一格式返回 Java 微服务 ...
- spring cloud Hystrix监控面板Hystrix Dashboard和Turbine
我们提到断路器是根据一段时间窗内的请求情况来判断并操作断路器的打开和关闭状态的.而这些请求情况的指标信息都是HystrixCommand和HystrixObservableCommand实例在执行过程 ...
随机推荐
- window7下安装Elasticseach5.2.2
1. 安装JDK,至少1.8.0_73以上版本 java -version 2. 下载和解压缩Elasticsearch安装包,目录结构 3. 启动Elasticsearch:bin\elastics ...
- python-day15(正式学习)
目录 递归 函数自我嵌套 调用 直接调用 间接调用 为什么要用递归呢 如何使用递归 内置函数 掌握 了解 面向对象方法 面向过程编程 注册 分层实现功能 递归 递归的本质就是函数调用自身,当然也会有一 ...
- LeetCode_9_回文数字
回文数(LeetCode 9) 1.题目 判断一个整数是否是回文数.回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数. 示例 1: 输入: 121 输出: true 示例 2: 输入: - ...
- Python爬虫之简单的爬取百度贴吧数据
首先要使用的第类库有 urllib下的request 以及urllib下的parse 以及 time包 random包 之后我们定义一个名叫BaiduSpider类用来爬取信息 属性有 url: ...
- zookeeper 选举leader详解
一.前言 前面学习了Zookeeper服务端的相关细节,其中对于集群启动而言,很重要的一部分就是Leader选举,接着就开始深入学习Leader选举. 二.Leader选举 2.1 Leader选举概 ...
- python3的一些文件操作的脚手架
用python把原来的脚本重构了一下,其中写了文件操作的一些函数,如下: import os import shutil import hashlib import stat #查找文件夹中的某个文件 ...
- 使用python的kazoo模块连接zookeeper实现最基本的增删改查
kazoo的官方文档地址:https://kazoo.readthedocs.io/en/latest/index.html #!/usr/bin/env python # -*- coding: u ...
- vue学习【三】vue-router路由显示多页面
大家好,我是一叶,今天是七夕,单身狗的我还在这里写踩坑文.在这里还是要祝大家早日脱单(能不能脱单自己心里没个数吗).本篇继续踩坑,在单页面上展示多页的内容,大家的想法是什么,估计大家第一印象会是ifr ...
- MySQL第三讲 一一一一 视图、触发器、函数、存储过程
1. 视图 1.1 视图前戏 我们之前讲有,临时表的概念. 现在我们创建一个临时表:select * from (select * from tb1 where id between 10 and 1 ...
- DEV第三方控件的GalleryControl控件
1.获取选中的图片 List<GalleryItem> lstArray = gclImage.Gallery.GetCheckedItems(); 2.滚动到GalleryControl ...