spring cloud admin分布式监控

Admin 分布式监控

server端

首先引入依赖

<dependency>

<groupId>de.codecentric</groupId>

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

<version>2.1.1</version>

</dependency>

 

<dependency>

<groupId>de.codecentric</groupId>

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

<version>2.1.1</version>

</dependency>

接着修改application类,加入@EnableAdminServer注解

修改yml文件配置,具体的提醒之类的未设置。

server:

port: 8085

spring:

application:

name: admin

eureka:

client:

service-url:

defaultZone: http://localhost:8761/eureka/

management:

endpoints:

web:

exposure:

include: "*"

最后加入logback-spring.xml,需要自行配置

client端

首先引入依赖,不需要加任何注解。

<dependency>

<groupId>de.codecentric</groupId>

<artifactId>spring-boot-admin-starter-client</artifactId>

<version>2.1.1</version>

</dependency>

直接启动admin服务访问 http://localhost:8085/ 即可

yml可选配置参数

 

# 解决windows下运行时无法识别主机名的问题

spring.boot.admin.client.prefer-ip=true

server.port=7086

spring.application.name=zk_admin

eureka.instance.preferIpAddress=true

eureka.client.service-url.defaultZone=http://172.16.1.28:7082/eureka/,http://172.16.1.29:7082/eureka/

 

#定义各种额外的详情给服务端显示

#从pom.xml中获取

info.app.name="@project.name@"

info.app.description="@project.description@"

info.app.version="@project.version@"

info.spring-boot-version="@project.parent.version@"

info.version=@project.version@

#宕机邮件提示

spring.mail.host=smtp.126.com

spring.mail.username=****

spring.mail.password=*****

spring.boot.admin.notify.mail.from=*****

spring.boot.admin.notify.mail.to=******

 

management.security.enabled=false

management.security.roles=SUPERUSER

security.user.name=xjgz2018

security.user.password=xjgz2018.

security.basic.enabled=false

 

#开启shutdown的安全验证

endpoints.health.sensitive= true

endpoints.cors.allowed-methods=HEAD,GET,POST

#启用shutdown

endpoints.shutdown.enabled=true

#禁用密码验证

endpoints.shutdown.sensitive=false

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值