前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Sprint Boot Admin

Sprint Boot Admin

作者头像
十毛
发布2019-03-27 15:12:02
4740
发布2019-03-27 15:12:02
举报
文章被收录于专栏:用户1337634的专栏

上一篇文章介绍了如何使用Spring Actuator监控Spring Boot进程状态,但是都是以JSON格式返回结果,不够直观。本文介绍使用Spring Boot Admin实现进程状态的可视化。

效果图

监控效果图

整体结构

Spring Boot Admin

  • Spring Boot Admin Server负责收集各个Client的数据
  • 各台Client配置Server地址,启动后注册到服务器
  • 服务器不停地请求客户端的信息(通过Actuator接口)

设置Sping Boot Admin Server

首先建立一个Spring Boot Admin Server,只需要两步,非常简单

  • pom.xml
代码语言:javascript
复制
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-server</artifactId>
    <version>2.1.3</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
  • 设置服务器
代码语言:javascript
复制
@SpringBootApplication
//启用Admin服务器
@EnableAdminServer
public class AdminServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdminServerApplication.class, args);
    }
}

默认端口是8080

配置Client(被监控的Spring Boot Application)

  • pom.xml
代码语言:javascript
复制
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-client</artifactId>
    <version>2.1.3</version>
</dependency>
  • application.properties
代码语言:javascript
复制
spring.boot.admin.client.url=http://localhost:8080

其他常用配置

  • 设置Application名字:默认所有的Application的名字都是spring-boot-application
代码语言:javascript
复制
spring.boot.admin.client.instance.name=boot-client

参考

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019.02.24 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 效果图
  • 整体结构
  • 设置Sping Boot Admin Server
  • 配置Client(被监控的Spring Boot Application)
  • 其他常用配置
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档