SpringCloud-hystrixDashboard(服务监控)

                                 hystrixDashboard(服务监控)

注明:此项目为本人学习尚硅谷老师的教学视频然后整理核心的配置文件,所有的项目均在以下地址下载。
https://github.com/xwbGithub/microservicecloud下载

本项目请参考microservicecloud-consumer-hystrix-dashboard项目

核心文件介绍

1、新建项目

microservicecloud-consumer-hystrix-dashboard

pom文件的修改

<!-- hystrix和 hystrix-dashboard相关 -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>

yml文件

server:
  port: 9001

主启动类添加EnableHystrixDashboard

@ EnableHystrixDashboard开启仪表盘监控注解

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

微服务提供者添加监控jar

例如微服务提供者microservicecloud-provider-dept-8001/8002/8003

添加以下jar包,才能被dashboard监控

<!-- actuator监控信息完善 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

测试:

1、启动dashboard监控微服务http://localhost:9001/hystrix

2、然后启动3个集群服务,启动microservicecloud-provider-dept-hystrix-8001

输入访问地址:http://localhost:8001/hystrix.stream

在9001的监控界面输入要监控的微服务(http://localhost:8001/hystrix.stream)

会看到以下监控内容

(1)Deplay 该参数用来控制服务器上轮询监控信息的延迟时间,默认是2000毫秒,可以通过配置该属性来降低客户端的网络和cpu消耗。

(2)Title该参数对应了头部标题Hystrix Stream之后的内容,默认会使用哦具体监控实例的URL,可疑通过配置该信息来展示更合适的标题。

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值