Search code examples
microservicesspring-cloudnetflix-eureka

Registering Spring Cloud Microservice with Eureka server


I am trying to create spring cloud microservices and also need to include eureka server and zuul as spring cloud tools. Now I created one module in my one spring boot project. I registered that service with eureka server. And also I created one spring boot project for adding zuul service discovery and also registered with eureka project.

  • Here my doubt is that When I am adding another module as another spring boot project, Can I register that application also with my current eureka server as client? What type of relation that eureka server project and microservice having? one-To-One or One-To-Many? Can I register 3 or 4 microservices with one eureka server as client?

Solution

  • Eureka Server will let you add as many microservices (modules of spring boot projects like you said).

    From Spring Cloud landing page:

    As long as Spring Cloud Netflix and Eureka Core are on the classpath any Spring Boot application with @EnableEurekaClient will try to contact a Eureka server on http://localhost:8761 (the default value of eureka.client.serviceUrl.defaultZone):

    That means that you can use a single eureka server for multiple microservices which are registered as clients to the eureka server.

    So yes, it's a One-To-Many relationship.

    You will want at one point to look into multiple Eureka servers used in load balancing, for redundancy purposes, but for now you will be fine.