Eureka elegant stop taking Configuration

application.yml

management:
  endpoint:
    shutdown:
      enabled: true
  endpoints:
    web:
      exposure:
        include:
          - shutdown
          - info
          - health
spring:
  application:
    name: eureka-provider
server:
  port: 9090
eureka:
  client:
    service-url:
      defaultZone: http://eureka1:8761/eureka,http://eureka2:8761/eureka

By requesting http: // localhost: 9090 / actuator / shutdown elegant stop taking

Way above the service will stop running.

If you are a spring boot project can stop taking the following ways:

    @GetMapping("/offline")
    public void offline(){
        DiscoveryManager.getInstance().shutdownComponent();
    }

The only way to remove this service but does not stop the service from the eureka.

 

Guess you like

Origin www.cnblogs.com/ShaoXin/p/11102032.html