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

Posted 高因咖啡

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 微服务监控的主要内容,如果未能解决你的问题,请参考以下文章

Sprin Boot无RunWith注解解决办法

1.3.7.RELEASE -> 1.4.1.RELEASE | java.lang.NoSuchMethodError:org.springframework.boot.builder.Spr

spring boot 学习 ---- spring boot admin

Spring Boot Admin - 系统错误中打开的文件过多

spring boot admin

Spring Boot Admin 横空出世!