使用spring boot admin

本文介绍如何使用 SpringBoot Admin 实现应用的集中管理和监控。包括管理端和服务端的部署步骤、配置文件详解及客户端配置示例。

 

 

 

 

spring boot admin管理端,

需要部署成独立的应用

pom中添加依赖

<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
        </dependency>

 

appllication.properties:

server.port=8091
spring.boot.admin.url=http://localhost:${server.port}
spring.jackson.serialization.indent_output=true
endpoints.health.sensitive=false

管理端的端口设置为8091, 查看其他应用的状态也是从这个端口访问

 

应用代码修改:

入口加上 @EnableAdminServer

 

 

spring boot admin客户端

即普通的、需要被管理的web应用。

pom依赖

1 <dependency>
2             <groupId>de.codecentric</groupId>
3             <artifactId>spring-boot-admin-starter-client</artifactId>
4         </dependency>
5         <dependency>
6             <groupId>org.springframework.boot</groupId>
7             <artifactId>spring-boot-starter-security</artifactId>
8         </dependency>

application.properties配置:

spring.application.name=XXXX
spring.boot.admin.client.url=http://localhost:8091
##配置项不要加""
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
spring.boot.admin.client.url 指向的是spring-boot-admin-server的地址,示例中是8091

应用代码不需要修改

 

 

结果图:

 

点击查看详情

 

 

 

视频教程-- 在google中搜索 spring boot admin site:youtube.com

 

转载于:https://www.cnblogs.com/yszzu/p/9419700.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值