클라우드 환경의 다수의 서비스들의 로드 밸런싱 및 장애 조치 목적을 가진 미들웨어서버이다
로드 밸런싱 : 특정 서비스를 제공하는 서버가 여러대 있을 때 트래픽을 . 한 서버에 몰리지 않도록 하는 기술
미들웨어 : 양쪽의 서비스 중간에 위치해 매개 역할을 하는 소프트 웨어
Eureka Server에 등록된 서비스를 Eureka Client라고 부른다.
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
server:
port: 8761
spring:
application:
name: disocovery-service
eureka:
client:
register-with-eureka: false
fetch-registry: false
@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}
}
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
@EnableDiscoveryClient
@SpringBootApplication
public class CertificationApplication {
public static void main(String[] args) {
SpringApplication.run(CertificationApplication.class, args);
}
}
server:
port: 0 # 랜덤 포트
spring:
application:
name: certification
eureka:
instance:
instance-id: ${spring.cloud.client.hostname}:${spring.application.instance_id:${random.value}}
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://127.0.0.1:8761/eureka