• 搭建eureka,gateway,admin,redis,docker系列一admin


    spring cloud admin

    简介

    Spring Boot Admin 用于监控基于 Spring Boot 的应用,它是在 Spring Boot Actuator 的基础上提供简洁的可视化 WEB UI。Spring Boot Admin 提供了很多功能,如显示 name、id 和 version,显示在线状态,Loggers 的日志级别管理,Threads 线程管理,Environment 管理等。

    创建一个空的module项目

    添加pom依赖

    <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>log4j-over-slf4j</artifactId>
                    </exclusion>
    
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-starter-server</artifactId>
                <version>2.1.2</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-security</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
                <version>2.1.2.RELEASE</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/org.jolokia/jolokia-core -->
            <dependency>
                <groupId>org.jolokia</groupId>
                <artifactId>jolokia-core</artifactId>
                <version>1.6.2</version>
            </dependency> 
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>

    创建一个启动类

    @EnableAdminServer
    @EnableEurekaClient
    public class dxtAdminApplication {
        public static void main(String[] args) {
            SpringApplication.run(dxtAdminApplication.class, args);
        } 
    }

    配置文件

    spring:
      application:
        name: spring-boot-admin
      profiles:
        active:
          - secure
    server:
      port: 8788
    
    # tag::configuration-eureka[]
    eureka:   #<1>
      instance:
        leaseRenewalIntervalInSeconds: 10
        health-check-url-path: /actuator/health
      client:
        registryFetchIntervalSeconds: 5
        serviceUrl:
          defaultZone: ${EUREKA_SERVICE_URL:http://127.0.0.1:8761}/eureka/
    
    
    management:
      endpoints:
        web:
          exposure:
            include: "*"  #<2>
      endpoint:
        health:
          show-details: ALWAYS
    # end::configuration-eureka[]
    
    ---
    spring:
      profiles: insecure
    
    ---
    spring:
      profiles: secure
      security:
        user:
          name: "登录用户名"
          password: "登录密码"
    eureka:
      instance:
        metadata-map:
          user.name: "用户名"         #These two are needed so that the server
          user.password: "密码" #can access the protected client endpoints

    向注册中心注册自己

     打开本地localhost:8788 就能看到admin了,我这里有2个api项目 一个gateway 一个admin 

    下一章就开始做Redisapi项目

  • 相关阅读:
    [BJOI2015]树的同构 && 树哈希教程
    「HNOI2014」世界树
    CF613D Kingdom and its Cities
    「HEOI2014」大工程
    虚树教程
    [SDOI2011]消耗战
    CF1216E Numerical Sequence
    vim8.1安装
    luoguP5024 保卫王国
    动态DP教程
  • 原文地址:https://www.cnblogs.com/chenmengmeng/p/12576410.html
Copyright © 2020-2023  润新知