Victor Bu

户外, 旅行, 读书, 生活, 有趣

  • 首页
  • 旅行
  • 户外
  • 读书
  • 急救
  • 挨踢
所有文章 友链 关于我

Victor Bu

户外, 旅行, 读书, 生活, 有趣

  • 首页
  • 旅行
  • 户外
  • 读书
  • 急救
  • 挨踢

Spring Cloud 学习 (八) Spring Boot Admin

2019-06-16

Spring Boot Admin 用于管理和监控一个或者多个 Spring Boot 程序

新建 spring-boot-admin-server

pom

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<parent>
<artifactId>spring-cloud-parent</artifactId>
<groupId>com.karonda</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-boot-admin-server</artifactId>

<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

spring-boot-admin-starter-server 需要指定版本号

application.yml

1
2
3
4
5
6
7
8
9
10
11
12
server:
port: 8071


eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

spring:
application:
name: admin-server

启动类

1
2
3
4
5
6
7
8
@EnableAdminServer // 开启 Admin Server
@EnableEurekaClient
@SpringBootApplication
public class AdminServerApp {
public static void main(String[] args){
SpringApplication.run(AdminServerApp.class, args);
}
}

eureka-client

添加依赖

1
2
3
4
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

注册 Spring Boot Admin (SBA) 客户端有两种方式:一种是通过引入 SBA Client (spring-boot-admin-starter-client);另一种是基于 Spring Cloud Discovery, 不需要添加依赖

application.xml 添加

1
2
3
4
5
6
7
8
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS

测试

  1. 启动 eureka-server
  2. 启动 config-server
  3. 启动 eureka-client
  4. 启动 admin-server

访问 http://localhost:8071

完整代码:GitHub

本人 C# 转 Java 的 newbie, 如有错误或不足欢迎指正,谢谢

赏

谢谢你请我吃糖果

支付宝
微信
  • Microservices
  • Spring Cloud
  • Spring Boot Admin
  • IT

扫一扫,分享到微信

微信分享二维码
Spring Cloud 学习 (九) Spring Security, OAuth2
Spring Cloud 学习 (七) Spring Cloud Sleuth
© 2021 Victor Bu
Hexo Theme Yilia by Litten
  • 所有文章
  • 友链
  • 关于我

tag:

  • 海岛
  • 香港
  • 攻略
  • 急救
  • 徒步
  • 泰国
  • 东南亚
  • 柬埔寨
  • 越南
  • 甘肃
  • 深圳
  • 香港文化博物馆
  • 树莓派
  • Raspbian
  • Python
  • Samba
  • CentOS 7
  • Linux
  • Windows
  • Travis CI
  • Hexo
  • GitHub
  • GIS
  • Leaflet
  • VLC
  • SQL Server
  • hls
  • m3u8
  • WindowsAPICodePack-Shell
  • DotNetty
  • Modbus
  • CRC
  • HJ212
  • ngrok
  • js
  • Java
  • Spring
  • Spring Boot
  • Mybatis
  • Spring MVC
  • Netty
  • RESTful API
  • Unit testing
  • PLC
  • JPA
  • MySQL
  • Redis
  • Shell32
  • IDE
  • IDEA
  • MyBatis
  • Microservices
  • Spring Cloud
  • Eureka
  • Spring Security
  • OAuth2
  • JWT
  • Ribbon
  • Feign
  • Hystrix
  • Hystrix Dashboard
  • Turbine
  • Zuul
  • Spring Cloud Config
  • Spring Cloud Sleuth
  • Zipkin
  • Spring Boot Admin
  • UUID
  • Hibernate
  • Swagger
  • snowflake
  • CORS
  • RabbitMQ
  • Elasticsearch
  • Sharding-JDBC
  • MongoDB
  • Tomcat
  • JDK
  • MQTT
  • WebSocket
  • Kafka
  • Alibaba
  • Nacos
  • Spring Cloud Gateway
  • Dubbo
  • Sentinel
  • SkyWalking
  • Seata
  • MyBatis-Plus
  • RestTemplate
  • Jasypt
  • XXL-JOB
  • JJWT
  • Hyper-V
  • Flyway
  • Elastic
  • Kibana
  • Beats
  • Logstash
  • canal
  • MinIO
  • OSS
  • Shell
  • inotify
  • Paho
  • Loki
  • Promtail
  • Grafana
  • Prometheus
  • node exporter
  • Docker
  • Kubernetes
  • Alibaba Cloud
  • Jenkins
  • Maven
  • Git
  • Node.js
  • EMQ X
  • Google Authenticator
  • 医疗

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • 友情链接1
  • 友情链接2
  • 友情链接3
  • 友情链接4
  • 友情链接5
  • 友情链接6
很惭愧

只做了一点微小的工作
谢谢大家