当前位置:网站首页>Eureka protects itself

Eureka protects itself

2022-08-10 00:55:00 a breezy

Overview
Protected Mode is mainly used for a set of clients and Eureka ServerThere is protection in network partition scenarios.Once in protected mode,
Eureka Server will try to protect the information in its service registry and will not delete the data in the service registry, that is, it will not log out of any microservices.

 
如果在Eureka Server的首页看到以下这段提示,则说明Eureka进入了保护模式:
EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT.
RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE

Why does the Eureka self-protection mechanism occur?

In order to prevent EurekaClient from running normally, but in case of network failure with EurekaServer, EurekaServer will not immediately remove the EurekaClient service


What is Self Protection Mode?


By default, if EurekaServer does not receive a heartbeat from a microservice instance within a certain period of time, EurekaServer will log out the instance (default90 seconds).However, when a network partition failure occurs (delay, freeze, congestion), the microservice and EurekaServer cannot communicate normally, and the above behavior may become very dangerous-because the microservice itself is actually healthy, it is not at this time.This microservice should be logged out.Eureka solves this problem with "self-protection mode" - when the EurekaServer node loses too many clients in a short period of time (A network partition failure may have occurred), then the node will enter self-protection mode.

Configuration code modification instructions

By default, the self-protection mechanism is enabled

eureka.server.enable-self-preservation=true
Use eureka.server.enable-self-preservation=false to disable self-preservation mode

Turn off effects:

 server:#Close the self-protection mechanism to ensure that unavailable services are kicked out in timeenable-self-preservation: falseeviction-interval-timer-in-ms: 2000
 instance:#The time interval between the Eureka client sending the heartbeat to the server, in seconds (the default is 30 seconds)lease-renewal-interval-in-seconds: 1#The upper limit of the waiting time for the Eureka server after receiving the last heartbeat, in seconds (the default is 90 seconds), the timeout will eliminate the servicelease-expiration-duration-in-seconds: 2

原网站

版权声明
本文为[a breezy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208092245503532.html