springcloud中的admin模块用于服务监控,本节将阐述该模块。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
注意:springboot的版本是2.1.1.RELEASE,springcloud的版本是Greenwich.SR1,admin 的版本是2.1.2
@EnableAdminServer
@EnableEurekaClient
server:
port: 8001
spring:
application:
name: admin-server
eureka:
client:
service-url:
defaultZone: http://localhost:7561/eureka/
management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: health,info
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
注意:springboot的版本是2.1.1.RELEASE,springcloud的版本是Greenwich.SR1,admin 的版本是2.1.2
server:
port: 8002
spring:
application:
name: admin-client
boot:
admin:
client:
url: http://localhost:8001
eureka:
client:
service-url:
defaultZone: http://localhost:7561/eureka/
依次启动eureka,admin server,admin client,在浏览器中访问http://localhost:8001/#/wallboard,出现以下监控界面:
以上就是使用admin进行的服务监控。
原文:https://www.cnblogs.com/alichengxuyuan/p/12581319.html