SpringBootAdmin
不是Spring官方提供的模塊,它包含了Client
和Server
兩部分。server部分提供了用戶管理界面,client即爲被監控的服務。client須要註冊到server端。html
SpringBootAdmin提供了不多的幾個監控服務端點,須要依賴SpringBootActuator豐富監控功能。java
server端的配置很簡單,無需任何開發。git
第一步:引入依賴github
<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.3.0</version> </dependency>
第二步:在啓動類上增長@EnableAdminServer註解,開啓對spring-boot-admin的支持。web
@SpringBootApplication @EnableAdminServer public class SpringBootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAdminApplication.class, args); } }
作好以上配置,而後訪問http://ip:port;效果以下redis
目前尚未客戶端註冊到服務端,因此看不到任何監控的內容,接下來咱們建立一個客戶端而且註冊到服務端後再來看看效果。spring
這裏使用上一章的演示項目——spring-boot-actuator作爲客戶端。數據庫
第一步:引入依賴緩存
<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(二十二)實現郵件發送功能
這個系列的文章都是工做中頻繁用到的知識,學完這個系列,應付平常開發綽綽有餘。若是還想了解其餘內容,掃面下方二維碼告訴我,我會進一步完善這個系列的文章!