- springboot项目和springboot admin项目不建议放在一起,因为目的是为了监控,如果放在一起的话,一旦springboot挂了,springboot admin也就一起挂了,监控就失去意义.
- 搭建监控项目: 注意版本号要springboot版本号一致.
org.springframework.boot spring-boot-starter-web de.codecentric spring-boot-admin-starter-server 2.4.1 @SpringBootApplication @EnableAdminServer public class MindsaApplication { public static void main(String[] args) { SpringApplication.run(MindsaApplication.class, args); } }启动类上加注解EnableAdminServer
server: port: 8000配置端口8000
- 配置要监控的服务
de.codecentric spring-boot-admin-starter-client 2.4.1 版本号要一致
spring: application: name: jingxihua-inner # 服务名称 boot: admin: client: url: http://localhost:8000 #监控中心地址 instance: prefer-ip: true #以IP的形式展示服务列表 # 如果配置了server.servlet.context-path,则改地址也要加上 service-url: http://localhost:8088 #监控服务地址(当前服务的地址) server: port: 8088 management: endpoints: web: exposure: include: "*" endpoint: health: show-details: always logging: file: name: jingxihua-inner.log
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/214005.html原文链接:https://javaforall.net
