简体   繁体   中英

What is the use of fetchRegistry property in eureka server?

If Eureka client doesn't register itself with the eureka server by setting eureka: client: registerWithEureka: false, why does fetchRegistry property also needs to be set as false?

registerWithEureka controls whether or not this client registers itself and therefore becomes discoverable . This alone does not imply that this client is going to fetch the information on other services' endpoints and therefore being able to connect to them.

fetchRegistry controls whether or not this client is going to try to connect to the Eureka server(s) in order to download the information on other services' endpoint. It can do so without registering itself. Quoting the documentation :

Fetch Registry

Eureka clients fetches the registry information from the server and caches it locally. After that, the clients use that information to find other services.

Eureka client need to register with eureka server to become discoverable. Eureka server can act as client as well. So setting registerWith Eureka and fetchRegistry to false is mandatory

Only clients need to fetch registry to get the registered microservices for communication EurekaServer need not register itself and also need not fetch other registered Microservices

Two properties, eureka.client.fetch-registry and eureka.client.register-with-eureka, are properties that you might set on another microservice to tell them how they should interact with Eureka. But Eureka is also a microservice, so these properties can be used with a Eureka server to tell it how it should interact with other Eureka servers.

The default value for both of these properties is true, indicating that Eureka should fetch the registry from other Eureka instances, and it should register itself as a service with the other Eureka servers

if there aren't other Eureka servers when in development mode, you're setting them to false so that Eureka won't try to reach out to other Eureka servers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM