Spring-boot-admin功能说明
http://blog.csdn.net/xingfulangren/article/details/52304413
***************************************************
1. 准备
1.1 介绍
spring-boot-admin的Github源码地址:https://github.com/codecentric/spring-boot-admin
在Spring Boot Actuator的基础上提供简洁的可视化WEB UI,是用来管理 Spring Boot 应用程序的一个简单的界面,提供如下功能:
显示 name/id 和版本号
显示在线状态
Logging日志级别管理
JMX beans管理
Threads会话和线程管理
Trace应用请求跟踪
应用运行参数信息,如:
Java 系统属性
Java 环境变量属性
内存信息
Spring 环境属性
1.2组成部分
Spring-boot-admin由服务器端和客户端组成
服务器端配置(gradle工程):
build.gradle:compile("de.codecentric:spring-boot-admin-server:1.4.1")
compile("de.codecentric:spring-boot-admin-server-ui:1.4.1")
application.properties:server.port= 8090 (自定义)
spring.application.name=Spring Boot Admin Web (自定义)
spring.boot.admin.url=http://localhost:${server.port}(自定义)
spring.jackson.serialization.indent_output=true
endpoints.health.sensitive=false
info.version=1.0.0(自定义)
启动spring-boot项目时需要加上@SpringBootApplication和 @EnableAdminServer 标签
客户端配置(gradle工程):
build.gradle:compile("de.codecentric:spring-boot-admin-starter-client:1.4.1")
application.properties:spring.application.name=spring-boot-admin-client (自定义)
spring.boot.admin.url=http://localhost:8090(注册到server)
server.port=8080(自定义)
info.version=1.0.0 (自定义)
spring-boot-admin-server:服务器后端处理逻辑代码
spring-boot-admin-server-ui:前端界面展示
spring-boot-admin-starter-client:客户端,需要添加到spring-boot项目中
2. 工作原理
2.1 客户端注册
客户端启动后会实例化RegistrationApplicationListener,listener默认会每隔10s到服务端去注册下,如果已经存在,会refresh
具体代码如下:
在跟服务器注册之前,客户端会先实例化Application信息,获取相应的信息,然后通过restful http post请求跟服务器交互
服务端代码逻辑:服务器端首先会根据客户端的HealthUrl,通过SHA-1 算法得到客户端的id值,借此区分不同的客户端节点
获取到客户端id后,从服务端保存的ConcurrentHashMap 对象中,根据id获取客户端状态信息,如果存在状态信息,则refresh或者replace,否则往map中新加客户端信息
2.2 路由
客户端注册到服务端,会由服务端维护一层路由映射,会在路径上添加前缀、客户端id和后缀,默认前缀为:/api/applications 后缀:/**
Mapped URL path [/api/applications/73abdba9/health/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/env/**] onto handler of type
[class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/metrics/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/trace/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/dump/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/jolokia/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/info/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/activiti/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/logfile/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/refresh/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/flyway/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/liquibase/**] onto handler
of type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
Mapped URL path [/api/applications/73abdba9/heapdump/**] onto handler of
type [class
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
73abdba9
为客户端的id值
具体代码如下:
具体的路由信息如下:
route matched=Route(id=73abdba9-health, fullPath=/api/applications/73abdba9/health/**,path=/**,location=http://pc-PC:8090/health,prefix=/api/applications/73abdba9/health,
retryable=false, sensitiveHeaders=[],customSensitiveHeaders=false)
包含请求的路径,以及具体节点的实际访问路径(location)
2.3 具体请求执行路径
用户触发界面 -> 界面发起请求(带有具体的客户端id) -> 经过服务器端路由映射-> 具体节点的访问路径 -> 调用Spring Boot Autuator 监控接口获取数据返回
界面代码:
经过测试发现health 接口,默认每隔20秒都会触发一次,其它接口只有刷新后才会触发接口调用,也许health被设计成心跳连接(猜测)
3.Spring Boot Autuator 监控
Spring boot autuator 提供很多的Endpoints 访问
endpoints = { "env", "metrics","trace", "dump", "jolokia",
"info","activiti", "logfile", "refresh","flyway", "liquibase",
"heapdump" };
endpoints说明以及自定义:
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html
Spring-boot-admin功能说明的更多相关文章
- Springboot 系列(十七)迅速使用 Spring Boot Admin 监控你的 Spring Boot 程序,支持异常邮件通知
1. Spring Boot Admin 是什么 Spring Boot Admin 是由 codecentric 组织开发的开源项目,使用 Spring Boot Admin 可以管理和监控你的 S ...
- Spring Boot Admin的使用
http://www.jianshu.com/p/e20a5f42a395 ******************************* 上一篇文章中了解了Spring Boot提供的监控接口,例如 ...
- Spring Boot admin 2.0 详解
一.什么是Spring Boot Admin ? Spring Boot Admin是一个开源社区项目,用于管理和监控SpringBoot应用程序. 应用程序作为Spring Boot Admin C ...
- SpringCloud(8)微服务监控Spring Boot Admin
1.简介 Spring Boot Admin 是一个管理和监控Spring Boot 应用程序的开源软件.Spring Boot Admin 分为 Server 端和 Client 端,Spring ...
- Springboot监控之二:Spring Boot Admin对Springboot服务进行监控
概述 Spring Boot 监控核心是 spring-boot-starter-actuator 依赖,增加依赖后, Spring Boot 会默认配置一些通用的监控,比如 jvm 监控.类加载.健 ...
- 微服务架构之spring boot admin
Spring boot admin是可视化的监控组件,依赖spring boot actuator收集各个服务的运行信息,通过spring boot actuator可以非常方便的查看每个微服务的He ...
- Spring Boot Admin 2.1.0 全攻略
转载请标明出处: https://www.fangzhipeng.com 本文出自方志朋的博客 Spring Boot Admin简介 Spring Boot Admin是一个开源社区项目,用于管理和 ...
- spring boot 2.0.3+spring cloud (Finchley)8、微服务监控Spring Boot Admin
参考:Spring Boot Admin 2.0 上手 Spring Boot Admin 用于管理和监控一个或多个Spring Boot程序,在 Spring Boot Actuator 的基础上提 ...
- SpringBoot | 第二十八章:监控管理之Spring Boot Admin使用
前言 上一章节,我们介绍了Actuator的使用,知道了可通过访问不同的端点路径,获取相应的监控信息.但使用后也能发现,返回的监控数据都是以JSON串的形式进行返回的,对于实施或者其他人员来说,不是很 ...
- spring boot admin抛出"status":401,"error":"Unauthorized"异常
打开spring boot admin的监控平台发现其监控的服务明细打开均抛出异常: Error: {"timestamp":1502749349892,"status& ...
随机推荐
- (转)学习使用Jmeter做压力测试(一)--压力测试基本概念
一.性能测试的概念 性能测试是通过自动化的测试工具模拟多种正常峰值及异常负载条件来对系统的各项性能指标进行测试.负载测试和压力测试都属于性能测试,两者可以结合进行. 通过负载测试,确定在各种工作负载下 ...
- IP地址数据库-ISP运营商列表(2017年1月)
IP地址数据库 微信号:qqzeng-ip [全球旗舰版][国内精华版][国外拓展版][英文版][掩码版] http://qqzeng.com 中国大陆:三大基础运营商 中国电信中国联通中国 ...
- msql,触发器无事物回滚,插入之前满足条件再插入
很少写mysql的触发器和存储过程,由于需要需要做一个很小的判断,要用到触发器,要达到的效果就是,插入之前判断是否满足条件如果不满足就不插入 如果用sqlserver 或者orcale 就很简单,按s ...
- 求android ble 解决方案!
智能医疗的产品,求ble解决方案:整体结构如下: 名词定义: 盒子:基于android4.3或以上版本的硬件,需支持wifi.ble 手机:android/ios 手机,用户使用 服务器:云服务器,盒 ...
- CSS、HTML5、JS
[att*=value]{}包含value属性的所有元素样式.[id*=div]{} a[href$=jpg]:after{} [att^=value]{}开头字符包含value属性的所有元素样式 [ ...
- List view优化
ListView 针对每个item,要求 adapter "返回一个视图" (getView),也就是说ListView在开始绘制的时候,系统首先调用getCount()函数,根据 ...
- CentOS 6.5、6.7 设置静态 ip 教程
CentOS 6.5.6.7 设置静态 ip 教程,可以ping通外网:www.baidu.com ①. 网络适配器(VMware Network Adapter) 选择NAT模式 ②. 设置静态 i ...
- [OSG]OSG例子程序简介
1.example_osganimate一)演示了路径动画的使用(AnimationPath.AnimationPathCallback),路径动画回调可以作用在Camera.CameraView.M ...
- .net 验证码
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- webstorm运行到服务器(Apache)
昨天百度了很多关于webstorm怎么运行到服务器当中的例子,但是我都阅读了一遍,里边貌似没有是关于Apache跟webstorm的配置方式.所以下面是我给大家分享我的亲身体验. 再次强调:这里用的8 ...