zoukankan      html  css  js  c++  java
  • 微服务:整合 Spring Boot Admin

    一、简介

      Spring Boot Admin 用于监控基于 Spring Boot 的应用,它是在 Spring Boot Actuator 的基础上提供简洁的可视化 WEB UI。

      客户端应用可以通过Spring Boot Admin Client或者注册中心就可以注册到Spring Boot Admin服务端进行监控。Spring Boot Admin 是在 Spring Boot Actuator 的基础上提供简洁的可视化 WEB UI。2.X版本使用Vue.js重写了UI界面,简洁。

    二、服务端搭建实战

    1、项目结构

    2、父pom.xml

     定义Spring Boot 及 Spring Cloud 版本

    <?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.microservice</groupId>
        <artifactId>microservice-minitor</artifactId>
        <packaging>pom</packaging>
        <version>1.0-SNAPSHOT</version>
        <modules>
            <module>microservice-monitor-server</module>
        </modules>
    
        <properties>
            <java.version>1.8</java.version>
            <spring-boot.version>2.2.4.RELEASE</spring-boot.version>
            <spring-cloud.version>Hoxton.SR1</spring-cloud.version>
        </properties>
    
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-parent</artifactId>
                    <version>${spring-boot.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    
                <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>
    
    </project>

    3、microservice-monitor-server -> pom.xml

    <?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">
        <parent>
            <artifactId>microservice-minitor</artifactId>
            <groupId>com.microservice</groupId>
            <version>1.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    
        <artifactId>microservice-monitor-server</artifactId>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-starter-server</artifactId>
                <version>2.2.0</version>
            </dependency>
        </dependencies>
    </project>

    4、microservice-monitor-server ->  MinitorServerApplication

    package com.microservice.minitor;
    
    import de.codecentric.boot.admin.server.config.EnableAdminServer;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    @EnableAdminServer
    public class MinitorServerApplication {
        public static void main(String[] args) {
            SpringApplication.run(MinitorServerApplication.class, args);
        }
    }

    5、microservice-monitor-server ->  application.yml

    server:
      port: 8888
    spring:
      application:
        name: SpringBootAdmin
      boot:
        admin:
          ui:
            title: SpringBootAdmin-Server

    三、运行测试

    打开浏览器:http://localhost:8888/applications

     出现如下界面,就表示Spring Boot Admin 服务端搭建成功!

  • 相关阅读:
    LoadRunner系统资源监视
    Loadrunner web_url函数学习(转贴)
    Chrome的开发者工具(Chrome Developer Tools)
    浏览器对同一域名进行请求的最大并发连接数(转贴)
    转贴---Performance Counter(包含最全的Windows计数器解释)
    去掉html代码中多余琐碎的标签
    你永远不知道什么地方有笔误
    office2016开发者选项在哪?
    [VBA]检测一个中文字符串是否包含在另一个字符串中
    电子发票怎么开
  • 原文地址:https://www.cnblogs.com/yansg/p/12574949.html
Copyright © 2011-2022 走看看