springboot中关闭eureka server中已注册服务列表自我保护配置
配置集群服務可以向eureka通知應用是否可以使用
a、在eureka server的application.properties中加入:
# 設為false,關閉自我保護
eureka.server.enable-self-preservation=false
# 清理間隔(單位毫秒,默認是60*1000)
eureka.server.eviction-interval-timer-in-ms=20000?
b、在個application的application.properties中加入:
# 開啟健康檢查(需要spring-boot-starter-actuator依賴)
eureka.client.healthcheck.enabled=true
# 續約更新時間間隔(默認30秒)
eureka.instance.lease-renewal-interval-in-seconds=30
# 續約到期時間(默認90秒)
eureka.instance.lease-expiration-duration-in-seconds=90
c、如果沒有加過actuator的引用,在pom.xml中加入
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
不然啟動應用會有
“Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/actuate/health/HealthAggregator“
轉載于:https://www.cnblogs.com/zhucezmf/p/10186632.html
總結
以上是生活随笔為你收集整理的springboot中关闭eureka server中已注册服务列表自我保护配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【旧文章搬运】Win7可变对象头结构之I
- 下一篇: win10 如何打开telnet,ftp