Spring Boot Admin(基于SpringBoot)

Spring Boot Admin(基于SpringBoot2)

接着上篇文章SpringBootActuator来说如何配置和使用可视化工具Spring Boot Admin

1、配置服务器

创建SpringBoot,添加Admin依赖:

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

在主启动类中标注**@EnableAdminServer**注解,开启Admin服务:
在这里插入图片描述
启动项目:
在这里插入图片描述
因为只创建好了服务器,但是并没有服务注册,所有现在还是0;我们可以创建客户端来进行注册

2、配置客户端

根据当前SpringBoot项目添加Admin的客户端依赖:

        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.3.1</version>
        </dependency>

配置文件配置:

server:
  port: 9001
spring:
  application:
    name: actuator-test #配置客户端的名称
  boot:
    admin:
      client:
        instance:
          prefer-ip: true
        # 配置 SpringBoot Admin 服务端的地址
        url: http://localhost:8888

然后访问服务端页面:在这里插入图片描述

点击对应的实例就可以实时监控所有的信息:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Spring Boot Admin 是一个开源的管理工具,可以用来监控和管理 Spring Boot 应用程序,提供了一系列功能,如应用程序的状态监控、堆栈跟踪、日志级别控制等。下面是搭建 Spring Boot Admin 的步骤: 1. 在 pom.xml 文件中添加以下依赖: ```xml <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.3.1</version> </dependency> ``` 2. 在启动类上添加注解@EnableAdminServer: ```java @SpringBootApplication @EnableAdminServer public class SpringBootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAdminApplication.class, args); } } ``` 3. 配置被监控的应用程序,在被监控的应用程序的 pom.xml 文件中添加以下依赖: ```xml <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>2.3.1</version> </dependency> ``` 4. 在被监控的应用程序的配置文件中添加以下配置: ```yaml spring.boot.admin.client.url: http://localhost:8080 spring.boot.admin.client.username: admin spring.boot.admin.client.password: admin ``` 其中,`spring.boot.admin.client.url` 指向 Spring Boot Admin 服务器的地址,`spring.boot.admin.client.username` 和 `spring.boot.admin.client.password` 是访问 Spring Boot Admin 服务器的用户名和密码。 5. 启动 Spring Boot Admin 服务器和被监控的应用程序,访问 http://localhost:8080 即可查看被监控的应用程序的状态信息。 以上就是搭建 Spring Boot Admin 的简单步骤,希望能对你有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

springboot大神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值