IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> SpringCloud - Spring Cloud Netflix 之 Hystrix Dashboard仪表盘监控(九) -> 正文阅读

[Java知识库]SpringCloud - Spring Cloud Netflix 之 Hystrix Dashboard仪表盘监控(九)

阅读本文前可先参考

SpringCloud - Spring Cloud根/父项目,开发准备(二)_MinggeQingchun的博客-CSDN博客

https://blog.csdn.net/MinggeQingchun/article/details/125308948

https://blog.csdn.net/MinggeQingchun/article/details/125312594

一、Hystrix Dashboard

Hystrix 仪表盘(Hystrix Dashboard是Spring Cloud的仪表盘组件,可以查看Hystrix实例的执行情况,支持查看单个实例和查看集群实例,但是需要结合spring-boot-actuator一起使用。

Hystrix Dashboard主要用来实时监控Hystrix的各项指标信息。Hystrix Dashboard可以有效地反映出每个Hystrix实例的运行情况,帮助我们快速发现系统中的问题,从而采取对应措施

1、新建一个springboot Module(springcloud-6-service-eureka-hystrix-dashboard),设置父项目

2、添加 spring-cloud-starter-hystrix-dashboard等 依赖

<!-- spring-cloud-starter-netflix-hystrix-dashboard -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
        </dependency>
<!--继承统一的父项目-->
    <parent>
        <groupId>com.company</groupId>
        <artifactId>springcloud-demo</artifactId>
        <version>1.0.0</version>
    </parent>

    <groupId>com.company</groupId>
    <artifactId>springcloud-6-service-eureka-hystrix-dashboard</artifactId>
    <version>1.0.0</version>

    <name>springcloud-6-service-eureka-hystrix-dashboard</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!--spring web 起步依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- springboot 开发自动热部署 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

3、application.prperties配置文件中配置访问端口3721

4、在 Spring Boot 的启动类中,添加@EnableHystrixDashboard 注解,开启仪表盘功能

@EnableHystrixDashboard  //启用Dashboard服务可用
@SpringBootApplication
public class EurekaHystrix6DashboardApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaHystrix6DashboardApplication.class, args);
    }

}

5、启动springboot启动类,访问应用,再去查看 Hystrix Dashboard 控制台服务 http://localhost:3721/hystrix

Hystrix 仪表盘工程创建好之后,需要一个服务,让这个服务提供 一个路径为/actuator/hystrix.stream 接口,然后就可以使用 Hystrix 仪表盘来对该服务进行监控了

1、在消费者项目(springcloud-6-service-eureka-hystrix-consumer)添加?hystrix 的依赖 和springboot的一个监控actuator 依赖

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

        <!--springboot的一个监控actuator
            让这个服务提供一个路径为/actuator/hystrix.stream 接口,然后就可以使用 Hystrix 仪表盘来对该服务进行监控
        -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

2、配置文件需要配置 spring boot 监控端点的访问权限

#配置 spring boot 监控端点的访问权限
#暴露 endpoints,由于endpoints 中会包含很多敏感信息,除了 health 和 info 两个支持直接访问外,其他的默认不能直接访问
#或者指定
#management.endpoints.web.exposure.include=hystrix.stream
management.endpoints.web.exposure.include=*

3、访问入口 http://localhost:8081/actuator/hystrix.stream

要访问/hystrix.stream 接口,首先得访问 consumer 工程中的任意一个其他接口,否则直接访问/hystrix.stream 接口时会输出出一连串的 ping: ping: …,先访问 consumer 中的任意一个其他接口,然后再访问/hystrix.stream 接口即可

首先访问 consumer 工程中的任意一个其他接口

这时在访问?http://localhost:8081/actuator/hystrix.stream 就有数据

4、在DashBoard中输入?http://localhost:8081/actuator/hystrix.stream ,点击 Monitor Stream?

???????

?仪表盘开始监控

Hystrix 仪表盘监控数据解读

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2022-06-29 18:51:47  更:2022-06-29 18:53:07 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年4日历 -2024/4/26 8:46:20-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码