Eureka never cancels services

I am currently facing a problem where Eureka does not unregister a registered service. I pulled the Eureka server example directly from the git hub and made only one change, eureka.enableSelfPreservation = false . My application.yml application is as follows:

 server: port: 8761 eureka: enableSelfPreservation: false client: registerWithEureka: false fetchRegistry: false server: waitTimeInMsWhenSyncEmpty: 0 

I read that if 85% of registered services stop delivering heart rate within 15 minutes, Eureka suggests that the problem is with the network and will not unregister services that do not respond. In my case, only one service works for me, so I turned off the self-preservation mode. I suddenly kill the process and Eureka leaves the service registered for what seems like an indefinite amount of time.

My application.yml client looks like this:

 eureka: instance: leaseRenewalIntervalInSeconds: 3 client: healthcheck: enabled: true serviceUrl: defaultZone: http://localhost:8761/eureka/ appInfo: replicate: interval: 3 initial: replicate: time: 3 spring: rabbitmq: addresses: ${vcap.services.${PREFIX:}rabbitmq.credentials.uri:amqp://${RABBITMQ_HOST:localhost}:${RABBITMQ_PORT:5672}} 

My goal is to create a demo in which Eureka quickly discovers that the service is no longer working and another running service can quickly register itself.

At the moment, as soon as the eureka client is launched, it registers after 3 seconds. He just never cancels the registration when the service suddenly stops. After I kill the service, the Eureka dashboard reads:

EMERGENCY! EUREKA MAY BE WRONG CLAIMS WHEN THEY ARE NOT. UPDATES - LESS THAN THRESHOLD AND HERITAGE INSTANTS DO NOT LONG ONLY FOR SECURITY.

How can I prevent this behavior?

+21
spring-cloud netflix-eureka
Sep 16 '15 at 18:43
source share
2 answers

I realized that self-preservation was never turned off. It turns out the actual property

 eureka.server.enableSelfPreservation=false 

(see DefaultEurekaServerConfig Code), which I have not found anywhere. This solved my problem.

+22
Sep 17 '15 at 14:06
source share

I did the work of de-registering the service by setting the values โ€‹โ€‹below

Eureka server application.yml

 eureka: server: enableSelfPreservation: false 

Service application.yml

 eureka: instance: leaseRenewalIntervalInSeconds: 1 leaseExpirationDurationInSeconds: 2 

Full example here https://github.com/ExampleDriven/spring-cloud-eureka-example

+17
Jun 07 '16 at 21:07
source share



All Articles