如何监控springboot的健康状况

SpringBoot1.5.19.RELEASE

一、使用Actuator检查与监控

actuaotr是spring boot项目中非常强大的一个功能,有助于对应用程序进行监控和管理,通过restful api请求来监管、审计、收集应用的运行情况,针对微服务而言它是必不可少的一个环节。

  1. 在pom文件中添加Actuator坐标

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
  2. 在全局配置文件中设置关闭安全限制

    management.security.enabled=false
  3. 运行,会发现控制台打印信息变多了

  1. 直接访问

    eg: http://localhost:8080/health http://localhost:8080/dump http://localhost:8080/beans

具体可参考:https://www.cnblogs.com/baidawei/p/9183531.html

二、Spring Boot Admin

Spring Boot Admin 提供了很多功能,如显示 name、id 和 version,显示在线状态,Loggers 的日志级别管理,Threads 线程管理,Environment 管理等。

  1. 访问spring boot admin的github页面:https://github.com/codecentric/spring-boot-admin

    -------以下内容在服务端操作:

  2. 在pom文件中添加spring boot admin 坐标

    <dependencies>
    <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-server</artifactId>
    <version>1.5.7</version>
    </dependency>
    </dependencies>
  3. 在启动类中增加注解:@EnableAdminServer

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

    -------以下内容在客户端操作:

  4. 客户端(另一个项目)pom文件添加依赖

    <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-client</artifactId>
    <version>1.5.7</version>
    </dependency>
  5. 修改properties文件

    #服务端的ip地址和端口
    spring.boot.admin.url: http://localhost:8383
    management.security.enabled=false
  6. 此时客户端的端口是:8080 ; 服务端的端口是8383

  7. 先启动服务端,打开网页:http://localhost:8383 (什么都没有,因为客户端还没启动)

  1. 启动客户端

【SpringBoot】16. 如何监控springboot的健康状况的更多相关文章

  1. 【Springboot】用Prometheus+Grafana监控Springboot应用

    1 简介 项目越做越发觉得,任何一个系统上线,运维监控都太重要了.关于Springboot微服务的监控,之前写过[Springboot]用Springboot Admin监控你的微服务应用,这个方案可 ...

  2. Spring Boot(二十):使用spring-boot-admin对spring-boot服务进行监控

    Spring Boot(二十):使用spring-boot-admin对spring-boot服务进行监控 Spring Boot Actuator提供了对单个Spring Boot的监控,信息包含: ...

  3. Springboot监控之二:Spring Boot Admin对Springboot服务进行监控

    概述 Spring Boot 监控核心是 spring-boot-starter-actuator 依赖,增加依赖后, Spring Boot 会默认配置一些通用的监控,比如 jvm 监控.类加载.健 ...

  4. 使用spring-boot-admin对spring-boot服务进行监控

    原文:http://www.cnblogs.com/ityouknow/p/8440455.html 上一篇文章<springboot(十九):使用Spring Boot Actuator监控应 ...

  5. 使用spring-boot-admin对spring-boot服务进行监控(转自牛逼的人物)

    尊重原创:http://www.cnblogs.com/ityouknow/p/8440455.html 上一篇文章<springboot(十九):使用Spring Boot Actuator监 ...

  6. Jmeter实时监控+SpringBoot接口性能实战

    性能测试 Jmeter实时监控+SpringBoot接口性能实战 自动化 SpringBoot Java Jmeter实时监控+SpringBoot接口性能实战 一.实验目的及实验环境 1.1.实验目 ...

  7. 使用Prometheus监控SpringBoot应用

    通过之前的文章我们使用Prometheus监控了应用服务器node_exporter,数据库mysqld_exporter,今天我们来监控一下你的应用.(本文以SpringBoot 2.1.9.REL ...

  8. springboot中druid监控的配置(DruidConfiguration)

    当数据库连接池使用druid 时,我们进行一些简单的配置就能查看到sql监控,web监控,url监控等等. 以springboot为例,配置如下 import com.alibaba.druid.su ...

  9. Prometheus+Grafana监控SpringBoot

    Prometheus+Grafana监控SpringBoot 一.Prometheus监控SpringBoot 1.1 pom.xml添加依赖 1.2 修改application.yml配置文件 1. ...

随机推荐

  1. Python实现的数据结构与算法之基本搜索详解

    一.顺序搜索 顺序搜索 是最简单直观的搜索方法:从列表开头到末尾,逐个比较待搜索项与列表中的项,直到找到目标项(搜索成功)或者 超出搜索范围 (搜索失败). 根据列表中的项是否按顺序排列,可以将列表分 ...

  2. 刷LeetCode的简易姿势

    近期抽空刷了刷LeetCode,算是补补课. 由于不是很习惯直接在网页上Coding&Debug,所以还是在本地环境下进行编码调试,觉得基本OK后再在网页上提交. 主要采用Python3进行提 ...

  3. Linux 安装Navicat Premium 15

    参考:https://gitee.com/andisolo/navicat-keygen 安装 aptitude 管理软件 $ sudo apt-get install aptitude 安装Navi ...

  4. Jmeter之『Xpath提取器』

    1.使用Xpath提取时,有时候需要过滤标题,使用以下语句 //td[@class="r-count" and not(text()="回应")]

  5. Ubuntu通过iptables防止ssh暴力破解

    步骤 安装iptables-persistent用于保存iptables规则 配置iptables规则 实时更新iptables规则以拦截IP访问 安装iptables-persistent sudo ...

  6. Centos7安装MySQL8.0(RPM方式)

    人生处处皆学问,工作也是如此!过去不止一次在Linux上安装MySQL,可以说轻车熟路,但是写篇文章总结一下,发现有很多细节值得学习! 安装包选择 为什么用rpm? 在Linux系列上安装软件一般有源 ...

  7. Mysql的Sql语句优化

    在Mysql中执行Sql语句经常会遇到有的语句执行时间特别长的情况,出现了这种情况我们就需要静下心分析分析. 首先,我们需要确定系统中哪些语句执行时间比较长.这个可以使用Mysql的慢日志来跟踪.下面 ...

  8. MeteoInfoLab脚本示例:AIRS Swath HDF数据

    例子中的AIRS Swath HDF数据在Polar Stereographic(南极)投影中接近矩形,需要先从数据中读出经纬度及相关数据数组,利用surfacem函数绘制Swath数据(散点),在s ...

  9. BASH让标准输出和错误输出颜色不同

    shell中运行的程序输出有标准输出(stdout)和错误输出(stderr)两种.当在终端中运行一个进程时,默认是stdout和stderr混在一起的,需要区分只能去读内容,人眼不容易快速区分. 如 ...

  10. selenium---输入内容后搜索

    from time import sleep from selenium import webdriver br = webdriver.Chrome() url = "https://ww ...