SpringBootAdmin
不是Spring官方提供的模块,它包含了Client
和Server
两部分。server部分提供了用户管理界面,client即为被监控的服务。client须要注册到server端。java
SpringBootAdmin提供了不多的几个监控服务端点,须要依赖SpringBootActuator丰富监控功能。git
server端的配置很简单,无需任何开发。github
第一步:引入依赖web
<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.3.0</version> </dependency>
第二步:在启动类上增长@EnableAdminServer注解,开启对spring-boot-admin的支持。redis
@SpringBootApplication @EnableAdminServer public class SpringBootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAdminApplication.class, args); } }
作好以上配置,而后访问http://ip:port;效果以下spring
目前尚未客户端注册到服务端,因此看不到任何监控的内容,接下来咱们建立一个客户端而且注册到服务端后再来看看效果。数据库
这里使用上一章的演示项目——spring-boot-actuator作为客户端。segmentfault
第一步:引入依赖缓存
<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>2.3.0</version> </dependency>
第二部:将客户端注册到服务器端,服务器
spring: boot: admin: client: # 服务端地址 url: http://localhost:7019
效果以下:
为了监控更多的状态信息,咱们在客户端引入spring-boot-actuator
依赖。
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
因为actuator默认只开启了health和info两个web端口,若是想要在server端页面看到全部的监控信息,须要开启其余接口的web端口。
management: endpoints: web: exposure: include: "*"
如今的效果以下:
spring-boot-admin的应用就简单介绍完了。spring-boot-admin配合spring-boot-actuator实现多服务监控,不只能提供查看服务监控信息的ui,并且能够监控更加全面的内容。
star
支持一下!spring-boot-route(一)Controller接收参数的几种方式
spring-boot-route(二)读取配置文件的几种方式
spring-boot-route(五)整合swagger生成接口文档
spring-boot-route(六)整合JApiDocs生成接口文档
spring-boot-route(七)整合jdbcTemplate操做数据库
spring-boot-route(八)整合mybatis操做数据库
spring-boot-route(九)整合JPA操做数据库
spring-boot-route(十一)数据库配置信息加密
spring-boot-route(十二)整合redis作为缓存
spring-boot-route(十三)整合RabbitMQ
spring-boot-route(十五)整合RocketMQ
spring-boot-route(十六)使用logback生产日志文件
spring-boot-route(十七)使用aop记录操做日志
spring-boot-route(十八)spring-boot-adtuator监控应用
spring-boot-route(十九)spring-boot-admin监控服务
spring-boot-route(二十)Spring Task实现简单定时任务
spring-boot-route(二十一)quartz实现动态定时任务
spring-boot-route(二十二)实现邮件发送功能
这个系列的文章都是工做中频繁用到的知识,学完这个系列,应付平常开发绰绰有余。若是还想了解其余内容,扫面下方二维码告诉我,我会进一步完善这个系列的文章!