How to solve the problem that Eureka Server does not kick the node that has been shut down

How to solve the problem that Eureka Server does not kick the node that has been shut down

In the development process, we often hope that Eureka Server can quickly and effectively kick out the shut down nodes, but novices often encounter Eureka Server not kicking out the shut down nodes due to the Eureka self-protection mode and the long heartbeat cycle. Node problem. The workaround is as follows:

(1) Eureka Server: Configure to close self-protection, and configure the time interval for Eureka Server to clean up invalid nodes as needed.

1
2
eureka.server.enable-self-preservation # Set to false to turn off self-preservation
eureka.server.eviction-interval-timer-in-ms # Cleaning interval (in milliseconds, default is 60*1000)

(2) Eureka Client: configure the health check to be enabled, and configure the renewal update time and expiration time as needed.

1
2
3
eureka.client.healthcheck.enabled # Enable health check (requires spring-boot-starter-actuator dependency)
eureka.instance.lease-renewal-interval-in-seconds # Renewal update interval (default 30 seconds)
eureka.instance.lease-expiration-duration-in-seconds # Renewal expiration time (default 90 seconds)

Example:
server side configuration:

1
2
3
4
eureka:
server:
enable-self-preservation: false
eviction-interval-timer-in-ms: 4000

Client configuration:

1
2
3
4
5
6
7
eureka:
client:
healthcheck:
enabled: true
instance:
lease-expiration-duration-in-seconds: 30
lease-renewal-interval-in-seconds: 10

Note:
Changing the update frequency of Eureka will break the self-protection function of the server. It is not recommended to customize these configurations in a production environment.
See: https://github.com/spring-cloud/spring-cloud-netflix/issues/373

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326466585&siteId=291194637
Recommended