zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    从Python到Web开发
    源码安装缺少configure文件
    5
    4
    3
    2
    42
    1
    18
    41
  • 原文地址:https://www.cnblogs.com/arebirth/p/eurekagraceshutdown.html
Copyright © 2011-2022 走看看