springcloud+Eureka优雅关机

需要引入

 
    org.springframework.boot
    spring-boot-starter-actuator


```java
//引入依赖后会不止这一个endpoint,并且需要安全认证,当然也可以配置不需要安全认证:
management.security.enabled=false
//另外记得配如下配置
management.endpoints.enabled=true
management.endpoints.web.base-path=/actuator 默认值是actuator
management.endpoints.web.exposure.include=service-registry,info,health,metrics
//有引入micrometer-registry-prometheus 是这个jar里的按以下配置
management.endpoints.web.exposure.include=service-registry,info,health,metrics,prometheus
management.endpoints.web.exposure.exclude=shutdown
server.servlet.context-path 非必须

//然后服务启动注册到Eureka Sever后调用
curl -X POST  http://127.0.0.1:8080/service-registry?status=DOWN  -H
              "Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8"

你可能感兴趣的:(springcloud,eureka,spring,boot)