当前位置: 首页 > news >正文

网站设计费 建设费入什么科目网站快速收录入口

网站设计费 建设费入什么科目,网站快速收录入口,怎么做网站里的悬浮窗口,关于企业网站开发与设计论文目录一、简介二、搭建 springboot-admin 管理服务1.Maven 依赖2.application.yml3.添加 EnableAdminServer4.启动服务,查看页面三、搭建 springboot-admin-client 客户端服务1.Maven 依赖2.application.yml3.启动服务,查看页面四、搭配 Eureka 使用1.搭建…

目录

    • 一、简介
    • 二、搭建 springboot-admin 管理服务
      • 1.Maven 依赖
      • 2.application.yml
      • 3.添加 @EnableAdminServer
      • 4.启动服务,查看页面
    • 三、搭建 springboot-admin-client 客户端服务
      • 1.Maven 依赖
      • 2.application.yml
      • 3.启动服务,查看页面
    • 四、搭配 Eureka 使用
      • 1.搭建 springboot-eureka 服务
        • 1.1)Maven 依赖:
        • 1.2)application.yml:
        • 1.3)添加 @EnableEurekaServer 注解
        • 1.4)启动服务
      • 2.调整 `springboot-admin` 管理服务
        • 1.1)Maven依赖:
        • 1.2)application.yml
        • 1.3)启动服务
      • 3.调整 `springboot-admin-client` 客户端服务
        • 1.1)Maven依赖:
        • 1.2)application.yml
        • 1.3)启动服务

上一章 SpringBoot实战(十二)我们集成了 Spring Actuator,我们拿到了应用服务的健康状态指标以及其他参数。这一章,我们就来看一下基于 Spring Actuator 数据进行图形化界面展示的 Spring Boot Admin 框架。

一、简介

Spring Boot Admin: Spring Boot Admin 是一个开源项目,提供了一个基于 web 的界面来管理和监控 Spring Boot 的应用程序。它可以实时监控您的 Spring Boot 应用程序,包括健康状况、指标和其他有用信息。

GitHub: https://github.com/codecentric/spring-boot-admin

官方文档: https://codecentric.github.io/spring-boot-admin/2.5.1/#getting-started

通过 Spring Boot Admin,我们可以轻松地从一个仪表板管理多个 Spring Boot 应用程序。我们可以查看每个应用程序的详细信息,包括内存使用情况、CPU 使用情况、线程等等。您还可以查看每个应用程序的配置属性,并在运行时进行编辑。

Spring Boot Admin 还提供了一个集中查看 Spring Boot 应用程序日志的地方。您可以按日期、日志级别和文本搜索过滤日志。这可以帮助我们快速排查应用程序中的问题。

此外,Spring Boot Admin 还具有发送通知的内置支持,当发生某些事件时,例如应用程序关闭或堆使用超过某个阈值时,您可以接收到通知。

总体而言,Spring Boot Admin 是一个有用的工具,用于管理和监控您的 Spring Boot 应用程序。它可以帮助您快速识别和排查问题,同时为您的应用程序的健康和性能提供有价值的参考。

这里,我们会一起创建一个 Spring Boot Admin 的管理服务客户端服务

二、搭建 springboot-admin 管理服务

1.Maven 依赖

<properties><java.version>1.8</java.version><spring.boot.version>2.4.5</spring.boot.version><spring.cloud.version>2020.0.3</spring.cloud.version><admin.starter.server.version>2.3.1</admin.starter.server.version>
</properties>
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!-- spring-boot-admin --><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-server</artifactId><version>${admin.starter.server.version}</version></dependency><!-- Eureka --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</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>

2.application.yml

server:port: 8000spring:application:name: springboot-adminmanagement:endpoint:health:show-details: always

3.添加 @EnableAdminServer

在启动类添加 @EnableAdminServer 注解:

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

4.启动服务,查看页面

启动 springboot-admin 服务,访问地址:http://localhost:8000

在这里插入图片描述

三、搭建 springboot-admin-client 客户端服务

1.Maven 依赖

<properties><java.version>1.8</java.version><spring.boot.version>2.4.5</spring.boot.version><spring.cloud.version>2020.0.3</spring.cloud.version><admin.starter.client.version>2.3.1</admin.starter.client.version>
</properties>
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!-- spring-boot-actuator --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><!-- spring-boot-admin-client --><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-client</artifactId><version>${admin.starter.client.version}</version></dependency>
</dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</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>

2.application.yml

server:port: 8001spring:application:name: springboot-admin-clientboot:admin:client:api-path: /instancesurl: http://127.0.0.1:8100instance:prefer-ip: true # 使用ip注册进来management:endpoint:health:show-details: alwaysendpoints:enabled-by-default: trueweb:base-path: /actuatorexposure:include: "*"

3.启动服务,查看页面

启动 springboot-admin-client 服务,再次访问地址:http://localhost:8000

在这里插入图片描述

点击 应用墙,我们可以看到目前是只有一个客户端服务。

在这里插入图片描述

点击这个服务,我们可以看到当前服务的元数据、进程和线程的状态等信息。

在这里插入图片描述

以上就是 Spring Boot Admin 框架的原始集成方式。

四、搭配 Eureka 使用

其实 Spring Boot Admin 可以搭配 Eureka 注册中心,实现自动扫描注册到注册中心上的所有服务,只要服务中集成了 Spring Actuator

1.搭建 springboot-eureka 服务

1.1)Maven 依赖:

<properties><java.version>1.8</java.version><spring.boot.version>2.4.5</spring.boot.version><spring.cloud.version>2020.0.3</spring.cloud.version>
</properties>
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- eureka --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId></dependency>
</dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</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>

1.2)application.yml:

server:port: 1001spring:application:name: springboot-eurekasecurity:user:name: demopassword: Demo2023eureka:instance:hostname: localhostclient:# eureka.client.registerWithEureka :表示是否将自己注册到Eureka Server,默认为true。# 由于当前这个应用就是Eureka Server,故而设为falseregister-with-eureka: false# eureka.client.fetchRegistry :表示是否从Eureka Server获取注册信息,默认为true。# 因为这是一个单点的Eureka Server,不需要同步其他的Eureka Server节点的数据,故而设为false。fetch-registry: falseserver:# 配置属性,但由于 Eureka 自我保护模式以及心跳周期长的原因,经常会遇到 Eureka Server 不剔除已关停的节点的问题enable-self-preservation: false# 清理间隔(单位毫秒,默认是60*1000),开发环境设置如下可快速移除不可用的服务eviction-interval-timer-in-ms: 5000

1.3)添加 @EnableEurekaServer 注解

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;@EnableEurekaServer
@SpringBootApplication
public class SpringbootDemoApplication {public static void main(String[] args) {SpringApplication.run(SpringbootDemoApplication.class, args);}
}

1.4)启动服务

启动服务,访问地址:http://localhost:1001

在这里插入图片描述

2.调整 springboot-admin 管理服务

1.1)Maven依赖:

<properties><java.version>1.8</java.version><spring.boot.version>2.4.5</spring.boot.version><spring.cloud.version>2020.0.3</spring.cloud.version><admin.starter.server.version>2.3.1</admin.starter.server.version>
</properties>
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- spring-boot-admin --><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-server</artifactId><version>${admin.starter.server.version}</version></dependency><!-- Eureka --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</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>

1.2)application.yml

server:port: 8000spring:application:name: springboot-adminmanagement:endpoint:health:show-details: always#eureka client
eureka:client:service-url:defaultZone: http://demo:Demo2023@localhost:1001/eureka/instance:hostname: localhostprefer-ip-address: true # 是否使用 ip 地址注册instance-id: ${spring.cloud.client.ip-address}:${server.port} # ip:portlease-renewal-interval-in-seconds: 5 # 实例续期心跳间隔(默认30s),设置之后启动服务不需要等很久就可以访问到服务的内容lease-expiration-duration-in-seconds: 15 # 实例续期持续多久后失效(默认90s)

1.3)启动服务

访问 Eureka 地址:http://localhost:1001

在这里插入图片描述

访问管理页面地址:http://localhost:8000/wallboard

在这里插入图片描述

3.调整 springboot-admin-client 客户端服务

1.1)Maven依赖:

<properties><java.version>1.8</java.version><spring.boot.version>2.3.6.RELEASE</spring.boot.version><spring.cloud.version>Hoxton.SR8</spring.cloud.version><admin.starter.client.version>2.3.1</admin.starter.client.version>
</properties>
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- spring-boot-actuator --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><!-- spring-boot-admin-client --><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-client</artifactId><version>${admin.starter.client.version}</version></dependency><!-- Eureka --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency>
</dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</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>

1.2)application.yml

server:port: 8001spring:application:name: springboot-admin-client
#  boot:
#    admin:
#      client:
#        api-path: /instances
#        url: http://127.0.0.1:8000
#        instance:
#          prefer-ip: true # 使用ip注册进来management:endpoint:health:show-details: alwaysendpoints:enabled-by-default: trueweb:base-path: /actuatorexposure:include: "*"#eureka client
eureka:client:service-url:defaultZone: http://demo:Demo2023@localhost:1001/eureka/instance:hostname: localhostprefer-ip-address: true # 是否使用 ip 地址注册instance-id: ${spring.cloud.client.ip-address}:${server.port} # ip:portlease-renewal-interval-in-seconds: 5 # 实例续期心跳间隔(默认30s),设置之后启动服务不需要等很久就可以访问到服务的内容lease-expiration-duration-in-seconds: 15 # 实例续期持续多久后失效(默认90s)

1.3)启动服务

访问 Eureka 地址:http://localhost:1001

在这里插入图片描述

访问管理页面地址:http://localhost:8000/wallboard

在这里插入图片描述

整理完毕,完结撒花~ 🌻





参考地址:

1.Spring Boot Admin 介绍及使用,https://blog.csdn.net/zouliping123456/article/details/121977792

http://www.dinnco.com/news/15622.html

相关文章:

  • wordpress 只显示一个主题seo智能优化系统
  • 随州网站seo多少钱如何引流与推广
  • 做网站的钱付款用途写什么游戏广告联盟平台
  • 网站流量降低外链怎么打开
  • 网站logo如何做链接怎么提高百度关键词排名
  • 一品威客网站是用什么平台做的软文标题
  • 海洋馆网站建设优化网站排名公司
  • 做网站新闻移动动态怎样优化网站排名靠前
  • 个人网站可以收费吗互联网推广引流公司
  • 淄博 网站建设江东seo做关键词优化
  • 做盗版视频网站吗谷歌广告代理公司
  • 网站定位模板长尾关键词查询
  • 做网站一般做几个尺寸seo营销优化软件
  • 建筑工程网站开发seo优化网站推广全域营销获客公司
  • html5页面模板大全廊坊seo排名收费
  • wordpress改成ajax青岛seo霸屏
  • 融资融券配资网站开发外贸推广如何做
  • 事业单位网站建设计划大型网站建站公司
  • 专门做鞋子的网站有哪些网络媒体发稿
  • 网站服务器如何做端口映射新手怎么学电商运营
  • 流量网站建设教程贵州seo技术查询
  • 做推文网站除了秀米还要什么成都进入搜索热度前五
  • 国产前端框架 做网站百度推广怎么做效果好
  • 找事做的网站seo网站推广与优化方案
  • com表示商业网站百度网址大全简单版
  • 样asp.net做网站2023适合小学生的新闻事件
  • 国外 素材 网站企业培训公司
  • 邯郸网站建代运营服务
  • 做招牌的网站交换友情链接是什么意思
  • 求创意设计分享的网站百度网站收录提交