티스토리 뷰

Data Engineering

[Flink] Kafka connector

헐리 2022. 9. 18. 18:36

kafka connector

kafka 토픽으로부터 데이터를 읽고 씀

 

checkpointing mechanism

exactly once를 보장하기 위해서 offset을 checkpointing 하고 추적함

 

 

position configuration

- setStartFromGroupOffsets: Flink는 컨슈머 그룹의 파티션들을 읽기 시작하고, kafka broker에 있는 offset을 커밋하는데, offset을 찾을 수 으면, auto.offset.reset 속성이 사용된다

- setStartFromEarliest(Latest): 이 모드에선 커밋된 offset들은 무시되고 시작 포시션으로 사용되지 않음

- job 이 실패해서 자동으로 복구하거나 savepoint 를 사용해서 복구하는 경우 start position 은 save point나 checkpoint에 저장된 offset에서 결정되는 것임 (configuration에서 결정되지 않음)

 

fault tolerance

checkpoint가 활성화 되었을때, flink는 카프카 컨슈머의 topic을 읽고, 카프카의 offset을 checkpointing 함

checkpoint 가 비활성화 되어있으면 카프카 컨슈머는 주기적으로 zookeeper에 offset을 커밋함

 

 

consumer lag

커밋된 offset과 각 partition의 최근 offset이 다른 경우를 consumer lag라고 함

flink가 새로운 데이터가 추가되는 시간보다 데이터를 늦게 읽는다면 lag 가 증가한다

 

Consumer Offset Committing

Kafka source commits the current consuming offset when checkpoints are completed, for ensuring the consistency between Flink’s checkpoint state and committed offsets on Kafka brokers.

 

 

checkpoint 

flink barrier는 datastream을 pre-checkpoint 와 post-checkpoint로 나눈다.

kafka는 checkpoint 전의 이벤트들이 처리되면 checkpoint가 되게하고, checkpoint 가 된 이벤트들은 처리되지 못하게 한다

 

 

 

Ref: https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/connectors/datastream/kafka/

 

Kafka

Apache Kafka Connector # Flink provides an Apache Kafka connector for reading data from and writing data to Kafka topics with exactly-once guarantees. Dependency # Apache Flink ships with a universal Kafka connector which attempts to track the latest versi

nightlies.apache.org

https://flink.apache.org/2020/10/15/from-aligned-to-unaligned-checkpoints-part-1.html

 

Apache Flink: From Aligned to Unaligned Checkpoints - Part 1: Checkpoints, Alignment, and Backpressure

Checkpoints are immutable and versioned: Together with immutable and versioned inputs (as input streams are, by nature), checkpoints support storing immutable application snapshots that can be used for rollbacks, debugging, testing, or as a cheap alternati

flink.apache.org

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함