eureka服务器中fetchRegistry属性有什么用?

What is the use of fetchRegistry property in eureka server?

如果Eureka client没有通过设置eureka: client: registerWithEureka: false向eureka server注册自己,为什么fetchRegistry 属性也需要设置为false?

Eureka 客户端需要向 eureka 服务器注册才能被发现。 Eureka 服务器也可以充当客户端。因此,必须将 registerWith Eureka 和 fetchRegistry 设置为 false

只有客户端需要获取注册表来获取注册的微服务进行通信 EurekaServer 不需要自己注册,也不需要获取其他注册的微服务

registerWithEureka 控制此客户端是否自行注册并因此成为 discoverable。这本身并不意味着此客户端将获取有关其他服务端点的信息,因此能够连接到它们。

fetchRegistry 控制此客户端是否将尝试连接到 Eureka 服务器以下载其他服务端点上的信息。它可以在不注册自己的情况下这样做。 引用 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.