MSA 27

[MSA] Spring Boot - Zipkin 이란? Spring Cloud Sleuth Example

https://zipkin.io/ OpenZipkin · A distributed tracing system Zipkin Zipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in service architectures. Features include both the collection and lookup of this data. If you have a trace ID in a log file, you can jump di zipkin.io zipkin Twitter에서 사용하는 분산 환경의 Timing 데이터 수집, 추적 시스템 분산환경에서의 시스템 병목 형상 파..

MSA 2023.05.14

[MSA] Spring Boot - CricuitBreaker란? Resilience4J example

CircuitBreak 장애가 발생하는 서비스에 반복적인 호출이 되지 못하게 차단 다른 서비스로 대체 수행 의존성 주입 (build.gradle) dependencies { implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j' ... } CircuitBreaker 설정 파일 (Default 설정 있어서 Custom 하게 사용할 경우만 생성) CircuitBreakerConfig failureRateThreshold CirucitBreaker open 결정 횟수 default : 50 waitDurationInOpenState CircuitBreak를 open 한 상태 유지하는 지속시간, 이후에는..

MSA 2023.05.13

[MSA] Spring Boot - Kafka Consumer, Producer Example

의존성 주입 (build.gradle) dependencies { ... implementation 'org.springframework.kafka:spring-kafka:2.8.0' } Kafka Consumer 설정 파일 ConsumerFactorcy - Topic에 접속에 필요한 정보 ConcurrentKafkaListenerContainerFactory - Topic 에 변경사할을 리스닝하는 리스너 package com.gugbab.gugbabservices.messagequeue; import ... @EnableKafka @Configuration public class KafkaConsumerConfig { Environment env; @Autowired public KafkaConsume..

MSA 2023.05.10

[MSA]Kafka Connect - Connect Source Example

Kafka Connect Source - 데이터를 보내는 쪽 Kafka Connect Source 등록 curl -X POST -d @- [kafka-Connect-server]/connectors --header "content-Type:applicatin/json" body ex) { "name": "gugbab-source-connect", // 커넥트 이름 "config": { "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector", "connection.url": "jdbc:mysql://localhost:3306/gugbabdb",// 연결할 DB "connection.user": "root",// DB 계정 "connection..

MSA 2023.05.08

[MSA] Apache Kafka란? Kafka 장단점

https://kafka.apache.org/ Apache Kafka Apache Kafka: A Distributed Streaming Platform. kafka.apache.org Kafka 란? Scalar로 개발된 오픈소스 메시지 브로커 모든 시스템으로 데이터를 실시간으로 전송할 수 있는 시스템 Kafka 특징, 장점 Producer, Consumer 분리 메시지를 여러 Consumer에게 허용 높은 처리량을 위한 메시지 최적화 클러스터 환경이어서 Scale out이 쉽다. Kafka Broker Kafka 애플리케이션 서버 3대 이상의 클러스터 서버 구성 권장 Broker를 중재해주는 코디네이터 사용 서버의 상태 장애 체크 주로 zookeeper 사용

MSA 2023.04.29

[MSA] Spring Boot - Feign Client Debug, 예외처리, ErrorDecoder사용

Feign Client - 디버그 application.yml Debug 레벨 설정 한다. applition에 feign client log bean을 등록을 한다. applition.yml - debug레벨 설정 logging: level: com.gugbab.gugbabservices.client: DEBUG application - bean 등록 package com.gugbab.gugbabservices; import ... @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients public class GugbabServicesApplication { ... // feign Client 로거 등록 @Bean public Logger.L..

MSA 2023.04.25

[MSA] Spring Boot - Feign Client 란? Rest Api 호출

Feign Client Netfix에서 개발된 Http client binder이다. 간편하게 Rest Api를 호출할 수 있다. 의존성 주입 (build.gradle) dependencies { implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' ... } Applicatoin - 어노테이션 등록 @EnableFeignClients 등록 import ... @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients public class GugbabVocaServerApplication { ... } Feign Client - 인터페이스 생성 @FeignClien..

MSA 2023.04.24