Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does eureka client provide registration information to eureka Server

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how eureka client provides registration information to eureka Server". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how eureka client provides registration information to eureka Server".

How does 1:eureka client register information with eurekaServer?

Use the Http request method when eureka client starts: the source code is as follows:

The interface provided by the eurekaServer side to the client registration information:

POST @ Consumes ({"application/json", "application/xml"}) public Response addInstance (InstanceInfo info, @ HeaderParam (PeerEurekaNode.HEADER_REPLICATION) String isReplication) {

. / / omit the code registry.register (info, "true" .equals (isReplication)); return Response.status (204) .build (); / / 204 to be backwards compatible}

2 how to achieve service renewal?

The timer sends a heartbeat to the server with an interval of 30s

3 when will the service be removed from eurekaServer?

When 90s did not receive the heartbeat of service renewal

Both of these parameters are configurable, but it is not recommended to modify them. The default values are 30 seconds and 90 seconds, respectively.

Eureka.instance.leaseRenewalIntervalInSecondseureka.instance.leaseExpirationDurationInSeconds

4 how does eureka client get the list of registration information?

EurekaClient timer acquires registration information from eurekaServer every 30 seconds, and stores it locally to facilitate calling other services.

5. Service offline

EurekaClient sends an offline notification to eurekaServer, after which the eurekaClient registration information will be deleted from the eurekaServer registry. Going offline is about to be called:

DiscoveryManager.getInstance () .shutdownComponent ()

6 eureka self-protection mechanism

The protection here refers to the protection of eurekaCLient instance registration information.

Threshold data: 75% in 15 minutes.

To put it simply: eureka server will count whether the client of client without renewal in 15 minutes is less than 85%. If lower than, zhe xie instances will be protected [so that these instances will not expire]

If the protection mechanism is turned on, there will be a problem: if a service provider dies at this time, but the registration information has not expired. At this point, a service consumer invokes the service, and the call fails, which is when the circuit breaker comes into play.

=

How to turn off the eurekaServer self-protection mechanism [not recommended]

Eureka.server.enable-self-preservation=false thank you for your reading, the above is the content of "how eureka client provides registration information to eureka Server". After the study of this article, I believe you have a deeper understanding of how eureka client provides registration information to eureka Server, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report