当前位置:网站首页>Turbine Aggregation Monitoring
Turbine Aggregation Monitoring
2022-07-29 16:33:00 【Big dream who realizes i】
一、搭建监控模块
1. Create the monitoring module
创建hystrix-monitor模块,使用TurbinePolymerization monitoring multipleHystrix dashboard功能,
2. 引入TurbinePolymerization started monitoring rely on
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hystrix-parent</artifactId>
<groupId>com.test</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hystrix-monitor</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</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-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
3. 修改application.yml
spring:
application.name: hystrix-monitor
server:
port: 8769
turbine:
combine-host-port: true
# Configuration of the need to monitor the service name list
app-config: hystrix-provider,hystrix-consumer
cluster-name-expression: "'default'"
aggregator:
cluster-config: default
#instanceUrlSuffix: /actuator/hystrix.stream
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
4. 创建启动类
@SpringBootApplication
@EnableEurekaClient
@EnableTurbine //开启Turbine Very polymerization monitoring function
@EnableHystrixDashboard //开启HystrixThe dashboard monitoring function
public class HystrixMonitorApp {
public static void main(String[] args) {
SpringApplication.run(HystrixMonitorApp.class, args);
}
}
二、修改被监控模块
需要分别修改 hystrix-provider 和 hystrix-consumer 模块:
1、导入依赖:
<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-netflix-hystrix-dashboard</artifactId>
</dependency>
2、配置Bean
此处为了方便,Be configured at startup class.
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/actuator/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
3、启动类上添加注解@EnableHystrixDashboard
@EnableDiscoveryClient
@EnableEurekaClient
@SpringBootApplication
@EnableFeignClients
@EnableHystrixDashboard // 开启HystrixThe dashboard monitoring function
public class ConsumerApp {
public static void main(String[] args) {
SpringApplication.run(ConsumerApp.class,args);
}
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/actuator/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
三、启动测试
1、启动服务:
eureka-server
hystrix-provider
hystrix-consumer
hystrix-monitor
2、访问:
在浏览器访问http://localhost:8769/hystrix/ 进入Hystrix Dashboard界面
Enter the monitoring interface ofUrl地址 http://localhost:8769/turbine.stream,监控时间间隔2000毫秒和title,如下图

实心圆:It has a color or size,Represent the instance of the monitoring level and the flow.如上图所示,它的健康度从绿色、黄色、橙色、红色递减.Through the solid circle show,我们就可以在大量的实例中快速的发现故障实例和高压力实例.
曲线:用来记录 2 分钟内流量的相对变化,我们可以通过它来观察到流量的上升和下降趋势.
边栏推荐
- 数字赋能机械制造业,供应链协同管理系统解决方案助力企业供应链再升级
- 理解 Web3 的权威指南
- Qt learning on the first day
- cmake(14):利用set_property命令设置全局属性
- Property (Property Animation Animation), the basic use of Butterknife butter knife
- 高通发布全新屏下指纹传感器:识别区域增大77%,识别速度提升50%
- Android Studio 实现登录注册-源代码 (连接MySql数据库)
- 蚂蚁三面滑铁卢!遭分布式截胡,靠这些笔记潜修 30 天,挺进京东
- The future trend of the conversation
- uni-app判断平台开发环境和生产环境
猜你喜欢
随机推荐
Hystri基本介绍和代码简单实现
奇怪,为什么ArrayList初始化容量大小为10?
我的 2019 年终总结
基于全志D1-H和XR806的名贵植物监控装置
易基因:人类tRNA基因位点表现出与衰老相关的DNA高甲基化|研究文章
浏览器线程
理解 Web3 的权威指南
MySQL数据库————数据库语言(DDL与DML)
Tess4J 图片文字识别
@RequestMapping注解最详细解析
nacos实现基本的服务跨进程调用和使用OpenFeign进行服务跨进程调用
边缘计算如何与小程序结合?智能家居如何借势发展?
风格迁移篇----艺术风格转换的内容与风格解构
File management: logical structure
cmake(14):利用set_property命令设置全局属性
应用程序间的数据传输TCP协议的特点及
uni-app判断平台开发环境和生产环境
电子元器件行业B2B交易系统:规范企业交易流程,提升销售管理效率
SQL 开始日期、结束日期查询
数商云SCM供应链系统方案服务亮点:生产管理更智能、产业供应链协同管理更便捷









