Spring-cloud-netflix: how to change service status?

Created on 8 May 2018  路  8Comments  路  Source: spring-cloud/spring-cloud-netflix

Is there a rest api that we can change service status in spring-cloud-netflix-eureka-client?
For example: I have a service registering Eureka, status is UP. No I want to change it's status from UP to OUT_OF_SERVICE. How can I get this?

question

Most helpful comment

@ryanjbaxter The command in Spring Cloud Finchley and version above goes:

curl -X "POST" "http://localhost:8000/actuator/service-registry?status=DOWN" \
   -H "Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8" 

All 8 comments

Just send a POST request to the /pause endpoint of your service instance.
Then, this instance will be marked as DOWN.

if you use Finchley or higher, just change /pause to /actuator/pause

I need change status from UP to OUT_OF_SERVICE.

Yes there is, for example

curl -X "POST" "http://localhost:8181/service-registry/instance-status" \
   -H "Content-Type: text/plain; charset=utf-8" \
   -d "OUT_OF_SERVICE"

Thanks, this is it.

Where is this function implemented?

The actuator endpoint is in spring-cloud-commons and the eureka implementation is in EurekaServiceRegistry.

Thanks锛乊ou are so handsome.

@ryanjbaxter The command in Spring Cloud Finchley and version above goes:

curl -X "POST" "http://localhost:8000/actuator/service-registry?status=DOWN" \
   -H "Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8" 
Was this page helpful?
0 / 5 - 0 ratings