spring boot admin服务监控

本文介绍了如何利用Spring Boot Admin实现服务监控。通过在Server端添加Spring Boot Admin依赖并启用@EnableAdminServer注解,结合Consul进行服务注册发现和配置中心管理。同时,Zuul作为网关处理路由。在Client端,配置与Server端相似,以实现被监控服务的接入。监控可以通过Web端进行查看。
摘要由CSDN通过智能技术生成

Consul:服务注册发现、配置中心

zuul:网关,路由

spring boot admin: 服务监控

SpringBootAdmin的Server端:

       只需要pom加入springbootadmin的Server依赖,在启动项加入@EnableAdminServer注解即可。

pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>zuul-gateway-test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>zuul-gateway-test</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <java.version>1.8</java.version>
        <elastic.version>7.6.0</elastic.version>
        <spring-cloud.version>2.2.4.RELEASE</spring-cloud.version>
        <log4j.version>1.2.17</log4j.version>
        <spring-boot-admin.version>2.3.0</spring-boot-admin.version>
        <docker.image.prefix>springboot</docker.image.prefix>
        <docker.maven.plugin.version> 1.2.2</docker.maven.plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions><!-- 去掉springboot默认配置 -->
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency> <!-- 引入log4j2依赖 -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <a
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值