Naming Server
Eureka Naming Server
Service registration
Each time a microservice comes up, it will register itself in the naming server.
Service discovery
Each time a microservice wants to talk to another microservice, the first one asks the naming server for the current target microservice instances addresses.
Defining a Eureka Naming Server
Config Client
Spring Boot Actuator
Eureka Server
Spring Boot Dev Tools
Annotate the main class with EnableEurekaServer
application.properties
spring.application.name=service-name
server.port=8761
eureka.client.fetch-registry=false
eureka.client.register-with-eureka=false
Connecting from client to Eureka Server
pom.xml
<dependency> <groupId>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-netflix-eureka-client</artifactId> </groupId> </dependency>
In main Class
application.properties
eureka.client.service-url.default-zone=eurekaServerUrl
Ribbon setup to use Naming Service
application.properties
comment
service-name.ribbon.listOfServers
Feign automatically tries to discover the service in Naming Service