微服务之服务监控篇 Actuator&Admin

微服务之服务监控篇 Actuator

服务监控

  1. 什么是服务监控?
    1. 主要是查看当前系统的运行状态,例如内存、线程、堆栈、日志等等,通过服务监控可以快速准确的发现问题,以减少或避免对用户的影响.
  2. 为什么使用服务监控
    1. 随着功能的拆分. 微服务越来越多,相互调用出错的概率也越来越大,如果不能及时发现问题会引起灾难性后果.

Spring Boot Actuator &Admin

  1. actuator是监控系统健康情况的工具,admin是一个针对spring-boot的actuator接口进行UI美化封装的监控工具
    在这里插入图片描述

入门小demo

  1. 创建SpringBoot项目版本2.3.5.RELEASE

  2. 引入依赖

    <!-- SpringBoot Web -->
    <dependency>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    
    <!-- SpringBoot Actuator -->
    <dependency>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-starter-actuator</artifactId>
    	<version>2.3.5.RELEASE</version>
    </dependency>
    
  3. application.yml配置

    management:
      endpoints:
        web:
          exposure:
            include: '*'  # 暴露所有的监控点
    
  4. 启动项目并访问: http://localhost:8080/actuator 服务端返回
    在这里插入图片描述

  5. 好丑啊,看不下去.

  6. 添加依赖并在启动类添加@EnableAdminServer注解

    <!-- SpringBoot Admin -->
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值