Framework & Library
-
Spring Boot - CORS 설정Framework & Library/Spring Boot 2023. 3. 20. 15:34
CORS CORS란? CORS(Cross-Origin Resource Sharing)는 출처가 다른 자원들을 공유한다는 뜻으로, 한 출처에 있는 자원에서 다른 출처에 있는 자원에 접근하도록 하는 개념이다. 직역하자면, 교차되는 출처 자원들의 공유이다. 다른 출처에 있는 자원을 요청한다고 하면, 이를 교차 출처 요청이라고 한다. CORS는 추가 HTTP 헤더를 사용하여, 한 출처에서 실행 중인 웹 애플리케이션이 다른 출처의 선택한 자원에 접근할 수 있는 권한을 부여하도록 브라우저에 알려주는 체제이다. 웹 애플리케이션은 리소스가 자신의 출처와 다를 때 교차 출처 HTTP 요청을 실행한다. 출처란? 먼저 출처라는 개념을 알아야 한다. 위 사진은 URL이 어떤 구성요소로 이루어져 있는지 나타내고 있다. 위 구성..
-
Kafka - In-Sync-ReplicasFramework & Library/Kafka 2023. 2. 20. 15:48
In-Sync-Replicas ISR(In-Sync-Replicas)이란? - In-Sync-Replicas(ISR)은 Follower가 잘 복사해 가고 있는지 판단하는 지표이다. - ISR은 High Water Mark라고 하는 지점까지 동일한 Replicas(Leader와 Follwer)의 목록이다. - Leader에 장애가 발생하면, ISR 중에서 새로운 Leader를 선출한다. - replica.lag.max.messages 옵션을 통해서 ISR을 판단하여 ISR 중에서 Leader를 선정한다. replica.lag.max.messages란? - replica.lag.max.messages는 Follower와 Leader 간의 지연된 메시지의 개수를 판단하는 기준이 된다. - 예를 들어서, rep..
-
Kafka - ReplicationFramework & Library/Kafka 2023. 2. 20. 10:45
Replication Broker의 장애 발생 - Broker에 장애가 발생하면, 장애가 발생한 Broker의 Partition들은 모두 사용할 수 없게 된다. - Partition을 사용할 수 없기 때문에, Producer는 메시지를 보낼 수 없게 되고 Consumer는 메시지를 받아갈 수 없는 상황이 발생한다. - Broker에서 장애가 발생하면 장애가 발생한 Partition을 대신해서 기존의 Broker 내에 새로운 Partition을 만들어 장애를 해결하는 것은 어떨까? - Partition을 새로 생성한다는 것은 기존의 메시지와 Offset 정보를 버린다는 의미이기 때문에, 큰 문제가 발생한다. - 위와 같은 문제를 해결하기 위해 나온 것이 Replication이다. Replication - ..
-
Kafka 기초 - ConsumerFramework & Library/Kafka 2023. 2. 18. 19:38
Consumer Consumer의 동작 방식 - Consumer는 각각 고유의 속도로 Partition으로부터 순서대로 Read를 수행한다. - 다른 Consumer Group에 속한 Consumer들은 서로 관련이 없으며, Partition에 있는 Event를 동시에 다른 위치에서 Read 할 수 있다. Consumer Offset - Consumer Offset은 Consumer Group이 읽은 위치를 표시하는 역할을 한다. - Consumer가 자동이나 수동으로 데이터를 읽은 위치를 commit 하여 다시 읽음을 방지한다. - __consumer_offsets라는 Internal Topic에서 Consumer Offset을 저장하여 관리한다. Partition과 Consumer 1. Multi-P..
-
Kafka 기초 - ProducerFramework & Library/Kafka 2023. 2. 18. 18:32
Producer Producer와 Consumer의 기본 동작 방식 - Producer와 Concumer는 서로 알지 못하며, Producer와 Consumer는 각각 고유의 속도로 Commit Log에 Write 및 Read를 수행한다. - 다른 Consumer Group에 속한 Consumer들은 서로 관련이 없으며, Commit Log에 있는 Event(Message)를 동시에 다른 위치에서 Read 할 수 있다. Record(Message)의 구조 - Record는 위 사진과 같이 Header, Key, Value로 구성된다. Serializer / Deserializer - Kafka는 Record를 Byte Array로 저장한다. - 위 사진과 같이, Key와 Value 용 Serializer..
-
Kafka 기초 - Broker, ZookeeperFramework & Library/Kafka 2023. 2. 18. 17:50
Broker, Zookeeper Broker - Broker는 Partition에 대한 Read 및 Write를 관리하는 소프트웨어이다. - Kafka Server라고 부르기도 한다. - Topic 내의 Partition들을 분산, 유지 및 관리하는 역할을 수행한다. - 각각의 Broker들은 ID로 식별되며, ID는 숫자로 이루어진다. - Broker는 Topic 데이터의 일부분을 가지고 있을 뿐, 데이터 전체를 가지고 있지는 않다. - Client는 특정 Broker에 연결하면 전체 Cluster에 연결된다. - 최소 3대 이상의 Broker를 하나의 Cluster로 구성해야 되며, 보통 4대 이상을 권장한다. - Topic을 구성하는 Partition들은 여러 Broker 상에 분산된다. - Top..