본문 바로가기
반응형

DEV/MSA4

MSA 시작하기 - Zuul Zuul JVM-based router and Server-side load balancer 마이크로서비스 아키텍처에서 여러 클라이언트 요청을 적절한 서비스로 프록시하거나 라우팅하기 위한 서비스 Zuul이 모든 요청을 관련 서비스에게 routing 한다. API Gateway 또는 Edge 서비스 역할을 한다. Frontend로 부터 모든 요청을 받아 내부 마이크로서비스들에게 요청을 전달하므로 단일 종단점을 갖게한다. 따라서 CORS, 인증, 보안과 같은 공통 설정을 Zuul 서비스에서 처리할 수 있다. 또한 클라이언트 요청을 적절한 서비스로 라우팅하거나 필터를 적용하여 헤더에 특정 정보를 추가할 수 있다. 사용 목적은 동적 라우팅, 모니터링, 회복 탄력성, 보안 기능을 지원 (Filters를 통한 구현.. 2021. 3. 11.
MSA 시작하기 - Ribbon Ribbon Inter Process Communication 라이브러리 Microservice 구성에서 서로 다른 서비스들을 쉽게 호출할 수 있도록 지원한다. 서비스의 instance가 여럿 실행 중인 경우 Ribbon을 통해 load balancing 기능을 이용할 수 있다. 자체 discovery 기능을 이용하여, eureka 서버의 registry에 등록된 서비스 탐색이 가능하다. Eureka Server의 registry 정보를 local에 caching 하여 빠른 처리를 할 수 있다. HTTP, TCP, UDP 를 모두 지원한다. Ribbon은 주로 zuul, feign, eureka 서비스를 사용할때 내부에서 같이 작동하게 된다. 2021. 3. 10.
Eureka Service 만들기 1. Service, ServiceBase생성 2. ServiceBase에 소켓연결부분에 추가 while(true) { Socket s = serverSocket.accept(); OutputStream out = s.getOutputStream(); DataOutputStream dos = new DataOutputStream(out); byte[] body = "Hello World".getBytes(); dos.writeBytes("HTTP/1.1 200 OK \r\n"); dos.writeBytes("Content-Type: text/html;charset=utf-8\r\n"); dos.writeBytes("Content-Length: " + body.length + "\r\n"); dos.wri.. 2021. 3. 9.
Spring Boot 에서 Eureka 시작하기 Eureka -server 1. Spring Boot project 생성 -> eureka server 선택 2. pom.xml에 Eureka Server dependency 추가 3. configuration - application.yml 수정 -> src/main/resources에 application.properties 삭제하고 application.yml 파일 생성 4. @EnableEurekaServer Annotation 추가하여 Eureka Server Application으로 선언 → Src/main/java에 eurekaserverapplication.java 열어서 @enableEurekaServer 추가해서 import하기 5. web에서 localhost:지정포트 로 접속하면 s.. 2021. 3. 8.
반응형