搭建好了spring boot admin服务并集成了邮件提醒,主要就是添加了依赖 Spring-boot-starter-mail 和增加了spring boot admin邮件相关配置:
server:
port: 8000
spring:
application:
name: admin-server
mail:
host: smtp.163.com
username: zhoulibo_vip@163.com
password: xxxx
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
boot:
admin:
notify:
mail:
from: zhoulibo_vip@163.com
to: 475379135@qq.com
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.10.4.86:8099//eureka/
management.security.enabled: false
启动spring boot admin项目后,发现很多服务状态都是Down,发现是actuator的health端点访问很慢超时造成的。经过排查,需要把management的检查数据库相关属性关闭掉,问题解决
management.security.enabled= false
management.health.db.enabled=false
management.health.mail.enabled=false
management.health.redis.enabled=false
management.health.mongo.enabled=false
另外,如果需要重新指定actuator相关endpoint访问页面并且在spring boot admin的监控台中查看相关信息,需要指定:
management.context-path=/xxx
同时也要设置eureka的metadata-map属性:
eureka:
instance:
non-secure-port: ${server.port:9000}
leaseRenewalIntervalInSeconds: 30
prefer-ip-address: true
health-check-url-path: /xxx/health
statusPageUrlPath: /xxx/info
metadata-map:
management:
context-path: /xxx
user.name: ${security.user.name}
user.password: ${security.user.password}
或者
eureka.instance.non-secure-port=${server.port:8080}
eureka.instance.leaseRenewalIntervalInSeconds=30
eureka.instance.prefer-ip-address=true
eureka.instance.health-check-url-path=/XXX/health
eureka.instance.statusPageUrlPath=/XXX/info
eureka.instance.metadata-map.management.context-path=/XXX
配置eureka
eureka.client.serviceUrl.defaultZone= http://172.10.4.86:8099//eureka/
以上设置针对于spring boot 1.5.x有效,如果是spring boot 2.0以上版本设置会有所不同