본문 바로가기

분류 전체보기590

Spring cloud gateway - eureka 연동 로드벨런싱 설정 1. Client 프로젝트 설정 - pom.xml, application.yml Spring Cloud Gateway 라이브러리 추가, 유레카 클라이언트 라이브러리 추가 유레카 서버 yml 설정 추가 org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.cloud spring-cloud-starter-gateway eureka: client: register-with-eureka: true fetch-registry: true service-url: defaultZone: http://localhost:8761/eureka 2. API Gateway 서버 설정 - application.yml uri에.. 2022. 7. 5.
Spring Cloud Gateway (api gateway) ※ 프로젝트 실행 환경 아래 환경에서 정상 실행 확인함 JDK : 1.8 Spring : 2.5.13 1. Spring Cloud Gateway 의존성 추가 2. application.yml 설정 eureka.client.fetch-registry=true는 유레카 서버로부터 인스턴스들의 정보를 주기적으로 가져올 것인지를 설정하는 속성임. true로 설정하면 갱신된 정보를 받겠다는 설정. defaultZone 값은 유레카 서버의 End Point 주소 입력하면 됨. server: port: 8000 eureka: client: register-with-eureka: true fetch-registry: true service-url: defaultZone: http://localhost:8761/eure.. 2022. 7. 4.
API Gateway Service API Gateway가 필요한 이유 API Gateway 같은 단일 진입점 없이 Client에서 직접 MicroService를 호출하게 된다면 마이크로 서비스가 생성/삭제/변화될때마다 Client에서의 수정이 필요하게 된다. 특징 및 장점 인증 및 권한 부여 서비스 검색 통합 응답 캐싱 정책, 회로 차단기 및 QoS 다시 시도 속도 제한 부하 분산 로깅, 추적, 상관 관계 헤더, 쿼리 문자열 및 청구 변환 IP 허용 목록에 추가 Spring Cloud에서 MSA간 통신을 위하여 사용하는 대표적인 방법 1. RestTemplate 2. Feign Client Ribbon : Client side Load Balancer - 서비스 이름으로 호출 - Health Check 2022. 7. 4.
유레카 클라이언트 설정 1. 유레카 클라이언트 의존성 추가 2. 유레카 클라이언트 어노테이션 등록 (@EnableDiscoveryClient) @SpringBootApplication @EnableDiscoveryClient public class UserServiceApplication { public static void main(String[] args) { SpringApplication.run(UserServiceApplication.class, args); } } 3. application.yml 설정 eureka.client.fetch-registry=true는 유레카 서버로부터 인스턴스들의 정보를 주기적으로 가져올 것인지를 설정하는 속성임. true로 설정하면 갱신된 정보를 받겠다는 설정. defaultZone .. 2022. 7. 3.