spring boot admin + spring boot actuator + erueka 微服务监控

时间:2024-05-13 21:37:08

spring boot admin + spring boot actuator + erueka 微服务监控关于spring boot actuator简单使用,请看

简单的spring boot actuator 使用,点击这里

spring boot admin 最新的正式版本是1.5.3 与 springboot 或者spring cloud 新版本不兼容 ,希望大家不要踩坑.

新版的  spring-cloud-netflix-core 1.3.4  移除了一个zuul的自动配置类,spring boot admin 1.5.0刚好引用了这个类.

新版的 spring-cloud-starter-hystrix 1.3.4 移除了 hystrix 的一个aop 类, spring boot admin 1.5.0刚好引用了这个类.

希望大家绕过坑所以在这里贴出完整的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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.lzw</groupId>
<artifactId>monitor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>monitor</name>
<description>monitor</description> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Camden.SR7</spring-cloud.version>
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
<spring-boot-admin.version>1.5.0</spring-boot-admin.version>
</properties> <dependencies> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>1.3.2.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
<version>1.3.2.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
<version>1.3.4.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-security</artifactId>
<version>1.2.1.RELEASE</version>
</dependency> <dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency> <dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency> <dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui-login</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency> </dependencies> <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> </project>

application.yml

server:
port: 8018
max-threads: 500
max-connections: 1000 eureka:
instance:
appname: monitor-server
instance-id: ${spring.cloud.client.ipAddress}:${server.port}
lease-renewal-interval-in-seconds: 10
lease-expiration-duration-in-seconds: 30
client:
serviceUrl:
defaultZone: http://monitor-server:123456@localhost:8000/eureka/ management:
security:
enabled:
security:
user:
name: admin
password: admin
     
直接连上eureka
浏览器打开: http://localhost:8018/ 输入admin,admin

spring boot admin + spring boot actuator + erueka 微服务监控


spring boot admin + spring boot actuator + erueka 微服务监控


spring boot admin + spring boot actuator + erueka 微服务监控