资讯专栏INFORMATION COLUMN

Spring Cloud Admin 实战

MrZONT / 2688人阅读

摘要:简介用于监控基于的应用,它是在的基础上提供简洁的可视化。提供了很多功能,如显示和,显示在线状态,的日志级别管理,线程管理,管理等。

Spring Cloud Admin

简介

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

基于Cairo-SR3 和 Finchley.SR1

在 Spring Boot 项目中,Spring Boot Admin 作为 Server 端,其他的要被监控的应用作为 Client 端,基于这种的配置如下步骤:

admin-server

@EnableAdminServer
@EnableEurekaClient
@SpringBootApplication
public class AdminServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AdminServerApplication.class, args);
    }

}

application.yml:

server:
  port: 5000
spring:
  application:
    name: admin-server
eureka:
  client:
    service-url:
      defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/

pom:


        
            
                io.spring.platform
                platform-bom
                Cairo-SR3
                pom
                import
            
            
                org.springframework.cloud
                spring-cloud-dependencies
                Finchley.SR1
                pom
                import
            
        
    

    

        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-client
        

        
            de.codecentric
            spring-boot-admin-starter-server
            2.0.1
        

    


    
        

            
                org.springframework.boot
                spring-boot-maven-plugin
            

            
                org.apache.maven.plugins
                maven-compiler-plugin
                
                    1.8
                    1.8
                    UTF-8
                
            
        
    

admin-clent

@EnableDiscoveryClient
@SpringBootApplication
public class AdminClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(AdminClientApplication.class, args);
    }

}

application.yml

server:
  port: 8762

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
spring:
  application:
    name: admin-client

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: always

pom:


        
            
                io.spring.platform
                platform-bom
                Cairo-SR3
                pom
                import
            
            
                org.springframework.cloud
                spring-cloud-dependencies
                Finchley.SR1
                pom
                import
            
        
    

    

        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-client
        

        
            de.codecentric
            spring-boot-admin-starter-client
            2.0.1
        

        
            org.springframework.boot
            spring-boot-starter-actuator
        

    

    
        
            
                org.apache.maven.plugins
                maven-compiler-plugin
                
                    1.8
                    1.8
                    UTF-8
                
            
        
    

eureka

@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaApplication.class, args);
    }

    @EnableWebSecurity
    static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.csrf().disable();
        }
    }

}

application.yml

server:
  port: 8761
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka

pom:

    
        
            
                io.spring.platform
                platform-bom
                Cairo-SR3
                pom
                import
            
            
                org.springframework.cloud
                spring-cloud-dependencies
                Finchley.SR1
                pom
                import
            
        
    

    
        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-server
        
        
            org.springframework.boot
            spring-boot-starter-security
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        
    

先启动eureka然后接着启动admin-client 和 admin-server 在浏览器打开url



github:https://github.com/janlle

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/74261.html

相关文章

  • Spring Cloud 上手实战-架构解析及实作

    摘要:服务器将要监听的端口不要使用服务进行注册不要在本地缓存注册表信息使用一个新的注解,就可以让我们的服务成为一个服务服务发现客户端配置以为例需要做件事情成为服务发现的客户端配置对应来说我们只需要配置如下启动运行查看。 Spring简介 为什么要使用微服务 单体应用: 目前为止绝大部分的web应用软件采用单体应用,所有的应用的用户UI、业务逻辑、数据库访问都打包在一个应用程序上。 showI...

    HitenDev 评论0 收藏0
  • Spring Cloud 上手实战-架构解析及实作

    摘要:服务器将要监听的端口不要使用服务进行注册不要在本地缓存注册表信息使用一个新的注解,就可以让我们的服务成为一个服务服务发现客户端配置以为例需要做件事情成为服务发现的客户端配置对应来说我们只需要配置如下启动运行查看。 Spring简介 为什么要使用微服务 单体应用: 目前为止绝大部分的web应用软件采用单体应用,所有的应用的用户UI、业务逻辑、数据库访问都打包在一个应用程序上。 showI...

    warmcheng 评论0 收藏0
  • Spring Cloud 上手实战-架构解析及实作

    摘要:服务器将要监听的端口不要使用服务进行注册不要在本地缓存注册表信息使用一个新的注解,就可以让我们的服务成为一个服务服务发现客户端配置以为例需要做件事情成为服务发现的客户端配置对应来说我们只需要配置如下启动运行查看。 Spring简介 为什么要使用微服务 单体应用: 目前为止绝大部分的web应用软件采用单体应用,所有的应用的用户UI、业务逻辑、数据库访问都打包在一个应用程序上。 showI...

    Godtoy 评论0 收藏0
  • Spring Boot Admin 2.0开箱体验

    摘要:概述在我之前的应用监控实战一文中,讲述了如何利用版本来可视化地监控应用。接下来我们就来创建一个待监控的示例。 showImg(https://segmentfault.com/img/remote/1460000015671446); 概述 在我之前的 《Spring Boot应用监控实战》 一文中,讲述了如何利用 Spring Boot Admin 1.5.X 版本来可视化地监控 ...

    CastlePeaK 评论0 收藏0
  • Spring Boot Admin 2.1.0 全攻略

    摘要:并向注册中心注册,注册地址为,最后将的所有端口暴露出来,配置如下在工程的启动类加上注解,开启的功能,加上注解开启的功能。在启动类加上注解,开启的功能。 转载请标明出处: https://www.fangzhipeng.com本文出自方志朋的博客 Spring Boot Admin简介 Spring Boot Admin是一个开源社区项目,用于管理和监控SpringBoot应用程序。 ...

    TalkingData 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<