搭建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依赖


        
            org.springframework.boot
            spring-boot-starter-web
            
                
                    org.slf4j
                    log4j-over-slf4j
                

            
        

        
            de.codecentric
            spring-boot-admin-starter-server
            2.1.2
        
        
            org.springframework.boot
            spring-boot-starter-security
        
        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-client
            2.1.2.RELEASE
        
        
        
            org.jolokia
            jolokia-core
            1.6.2
         
    
    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    

创建一个启动类

@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

向注册中心注册自己

搭建eureka,gateway,admin,redis,docker系列一admin_第1张图片

 

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

下一章就开始做Redisapi项目

你可能感兴趣的:(技术)