zoukankan      html  css  js  c++  java
  • 搭建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项目

  • 相关阅读:
    pthread_rwlock_rdlock和“No such file or directory”
    Thrift线程和状态机分析
    Haodoop RPC解析
    Thrift结构分析及增加取客户端IP功能实现
    StarUML 5.0问题解决:Failed to open the model file. Invalid file format.
    检测Linux系统是否支持某系统调用
    eclipse的thrift插件
    常见gcc编译问题解决方法集
    Thrift编译错误('::malloc' has not been declared)
    安装Android SDK Manager的“Failed to fetch refused”问题解决方法
  • 原文地址:https://www.cnblogs.com/chenmengmeng/p/12576410.html
Copyright © 2011-2022 走看看