Search code examples
springspring-cloudnetflix-eureka

What is Eureka service, Eureka Client, Eureka instance and Eureka server


I'm learning spring cloud Netflix by reading this article, however I started to get confused by different terminology in this article, they are:

  1. Eureka service. To my understand it's an ordinary service (specifically a Microservice) that running on a unique uri (i.e.one service per uri). Say localhost:12000. It is can be registered in the Eureka server.

  2. Eureka Client. Same thing as Eureka service???

  3. Eureka Server. To my understand, it's the server that we can inspect, discover and manage bunch of Microservices we built, normally running on localhost:8761

  4. Eureka Instance. I'm confused by what's it referred to, same thing as the Eureka client?

Also in this article, it mentions eureka.client in config and EurekaClient in Netflix API, are they referring to the same thing?

Please tell me what do these four terms mean and correct me if I'm wrong. Thank you!

==================================UPDATE==================================

In the article it said:

@EnableEurekaClient makes the app into both a Eureka "instance" (i.e. it registers itself) and a "client" (i.e. it can query the registry to locate other services).

So it looks like the Eureka instance is same as Eureka service. While Eureka Client is a special instance that can query for other instances/services.


Solution

  • I'd say these terms are used a bit ambiguously, here's what I think they mean in the article:

    • Eureka Client: it can be a microservice that is ready to work so it registers itself to the Eureka server e.g. an API for some app, or some application that goes to the server and asks for directions to a specific microservice.

    • Eureka Instance: a single instance of a microservice (you can add more instances of the same microservice as your load grows i.e. horizontal scaling).

    • Eureka Service: looks like when you register a microservice as an Eureka Client, you obtain an Eureka Service registered by an ID.

    • Eureka Server: a server where microservices can register themselves so others can discover them.


    About the update you added:

    Eureka Instance should not be confused with Eureka Service. Eureka Service refers to the group of microservice instances registered to the Eureka Server that provide the same service.

    About that @EnableEurekaClient annotation, it tells the following to the framework: hi there Spring, I am an instance of microservice X, so please register me to the Eureka Server (with eureka.instance.* properties), and I also want to discover other services, so create the necessary discovery client bean for me (with eureka.client.* properties).

    In summary, this annotation named @EnableEurekaClient does both things, maybe that's where the confusion comes from. But Instance and Client are indeed different concepts, even though they are used somewhat interchangeably in the article.