Eureka+SpringBoot2.X版本实现优雅停服


 

在客户端添加如下配置

 

pom依赖 actuator.jar包

  <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
  </dependency>
或者
<dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

application.yml全局配置文件添加如下

management:
  endpoints:
    web:
      exposure:
        include: shutdown #暴漏shutdown端点服务
  endpoint:
    shutdown:
      enabled: true

然后在postman里边用post请求方式,请求如下地址

http://ip:port/actuator/shutdown

 

 

 

官方介绍:

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM