如何监控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. 使用EasyX和C++写一个消砖块游戏

    第一次玩EasyX,写一个比较简单的消砖块游戏. 主函数包括Game的类的开始,运行和结束. 1 #include "BrickElimination.h" 2 3 int mai ...

  2. jquery购物车全选,取消全选,计算总金额

    这是html代码 <div class="gwcxqbj"> <div class="gwcxd center"> <div cl ...

  3. python实现自动生成小学四则运算题目(软工第二次项目作业)

    前言 软件工程 传送带 作业要求 传送带 作业目标 结对编程:代码实现.性能分析.异常处理说明.记录PSP表格 代码见: github 个人信息:朱育清 3118005437 信安二班 我的partn ...

  4. 多测师讲解selenium_输入性弹框定位_高级讲师肖sir

    #输入性弹框from selenium import webdriverfrom time import sleepdrvier=webdriver.Chrome()url='file:///F:\d ...

  5. 多测师讲解python _re模块_高级讲师肖sir

    import re# 一.常用方法:# match():从头匹配# search():从整个文本搜索# findall():找到所有符合的# split():分割# sub():替换# group() ...

  6. MeteoInfoLab脚本示例:计算垂直螺旋度

    尝试编写MeteoInfoLab脚本计算垂直螺旋度,结果未经验证. 脚本程序: print 'Open data files...' f_uwnd = addfile('D:/Temp/nc/uwnd ...

  7. spring boot:多模块项目生成jar包(spring boot 2.3.3)

    一,多模块项目的优点: 1,为什么要使用多模块项目? 相比传统的单体工程,使用Maven的多模块配置, 有如下优点: 帮助项目划分模块,鼓励重用, 防止POM变得过于庞大, 方便某个模块的构建,而不用 ...

  8. spring-boot-route(二十)Spring Task实现简单定时任务

    Spring Task是Spring 3.0自带的定时任务,可以将它看作成一个轻量级的Quartz,功能虽然没有Quartz那样强大,但是使用起来非常简单,无需增加额外的依赖,可直接上手使用. 一 如 ...

  9. Hadoop框架:DataNode工作机制详解

    本文源码:GitHub·点这里 || GitEE·点这里 一.工作机制 1.基础描述 DataNode上数据块以文件形式存储在磁盘上,包括两个文件,一个是数据本身,一个是数据块元数据包括长度.校验.时 ...

  10. 浅谈NLP 文本分类/情感分析 任务中的文本预处理工作

    目录 浅谈NLP 文本分类/情感分析 任务中的文本预处理工作 前言 NLP相关的文本预处理 浅谈NLP 文本分类/情感分析 任务中的文本预处理工作 前言 之所以心血来潮想写这篇博客,是因为最近在关注N ...