admin

发布时间 2023-05-29 11:21:44作者: 我不想学编丿程

admin监控

image-20230303142401324

1.入門admin-server

  1. 依賴

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

<dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
 </dependency>
  1. 开启配置和

    @EnableAdminServer
    
  2. 配置文件

server:
  port: 10086


spring:
  application:
    name: admin-server

eureka:
  client:
    service-url:
      defaultZone: http://peer2:8761/eureka

management:
  endpoints:
    web:
      exposure:
        include: '*'  # 暴露所有的监控端点 # 如果一个服务需要被监控 那么就要讲自身的一些情况(一些信息接口)暴露出去

2.入門admin-client

  1. 依賴
<!--  暴露自身检查端点 endPoints 一个依赖 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
  1. 配置

    management:
        endpoints:
            web:
                exposure:
                    include: '*'