SpringCloud elegant version of the hair

background

SpringCloud distributed projects deployed on multiple nodes. Hair version general way, the use of Kill -15 pid, one by one off, deployment, restart.

But the middle comes to a question, when executing the kill command, although the service is closed, but there is still preserved Eureka IP this server, the request will still go on this server.

Continued until after tens of seconds, Eureka weed out the IP services.

If the request is large, it will lead to a large number of requests an exception occurs in the hair version of the process. So to think of a more elegant way to deploy the service.

Option One:

Eureka call interface, so that the automatic rejection Eureka service IP.

Excluding the service from the list of available services

http://IP:port/eureka/apps/AppID/InstanceID/status?value=DOWN

The service is added to the list of available services

http://IP:port/eureka/apps/AppID/InstanceID/status?value=UP

Option II:

Call service interface, service Eureka report to the unavailable state

Projects to increase the allocation, focusing on service-registry

management.endpoints.web.base-path=/monitor
management.endpoints.web.exposure.include=health,service-registry
http://IP:port/monitor/service-registry?status=DOWN
http://IP:port/monitor/service-registry?status=UP

Reference Documents

How SpringCloud micro elegant service downtime and source code analysis https://www.jianshu.com/p/7587fddd4f0c

Guess you like

Origin www.cnblogs.com/fonxian/p/11278846.html