-
Notifications
You must be signed in to change notification settings - Fork 6
Spring Cloud Eureka
SirajChaudhary edited this page Sep 25, 2022
·
12 revisions
Eureka is the Netflix Service Discovery Server and Client.
Step1: Add spring cloud eureka server dependency in pom.xml in eureka-server microservice
<!-- spring cloud starter eureka server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
Step2: Add spring cloud eureka server properties in application.yaml in eureka-server microservice
# EUREKA SERVER PROPERTIES
eureka:
client:
register-with-eureka: 'false'
fetch-registry: 'false'
Step3: Mark main class with following annotation
@EnableEurekaServer
When eureka clients registers with eureka server, they provides meta-data about itself — such as host, port, health indicator URL, home page, and other details.
Step1: Add spring cloud eureka client dependency in pom.xml in every microservice and api-gateway microservice
<!-- spring cloud starter eureka client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
Step2: Add spring cloud eureka client properties in application.yaml in every microservice and api-gateway microservice
# EUREKA SERVER URL
eureka:
client:
service:
url:
defaultZone: 'http://localhost:8761/eureka
Step3: Mark main class with following annotation
@EnableEurekaClient