Codementor Events

Using Eureka Service Registry

Published Sep 25, 2019
Using Eureka Service Registry

One important component in the microservice architecture is the service registry, in this post we will learn how to configure spring cloud service registry using Netflix's Eureka, but what is the objective to have a service registry, well this component is used by the services to let know to Eureka Server that they are available and ready to take trafic and so the Eureka client could handle the load balancing.
If you want more details about Eureka here is the repository of the project: Netflix's Eureka
Now how can we use Eureka Server? with Spring Boot is pretty easier to have Eureka Server running in few steps, just like the previous post go to the spring initializr: start.spring.io and we just gonna need to add the dependency: eureka-server, see the image below:
eureka-dependency.png

Now we have the dependency we can dowload the zip file and extract in the location of our preference and add some configurations to have our eureka server ready, those configurations are:

  • Rename application.properties to application.yml
  • Configure port and exclude eureka client instance to register in the ureka server because we are going to use this application as server itself so it is not required to register the eureka instance
  • Enable eureka server
    See the images below with the configurations for our eureka server

eureka-yml.png

eureka-java.png

Once we have the configurations, let's run the application and open our browser at http://localhost:8082/

eureka-running.png

As you can see the eureka server is running, now we can start creating our microservices and they are going to register in the server.

And here we have the github repository
eureka-repository

Discover and read more posts from Victor de la Cruz
get started