고승범(peter.ko) / kakao corp.(인프라2팀)
---
카카오에서는 빅데이터 분석, 처리부터 모든 개발 플랫폼을 이어주는 솔루션으로 급부상한 카프카(kafka)를 전사 공용 서비스로 운영하고 있습니다. 전사 공용 카프카를 직접 운영하면서 경험한 트러블슈팅과 운영 노하우 등을 공유하고자 합니다. 특히 카프카를 처음 접하시는 분들이나 이미 사용 중이신 분들이 많이 궁금해하는 프로듀서와 컨슈머 사용 시의 주의점 등에 대해서도 설명합니다.
2. - 카카오 인프라팀 소속
- 페이스북 KAFKA 한국 사용자 그룹 개설자
(facebook.com/groups/kafkakorea/)
- <카프카, 데이터 플랫폼의 최강자> 저자
예스24 IT 분야 1위(이틀..;)
- Popit.kr 저자, 개인 브런치 운영 중
고승범 (peter.ko)
3. ‣ 카프카의 현황
‣ 트러블 슈팅
‣ Shrinking ISR
‣ Rack Power
‣ 프로듀서와 컨슈머
‣ 운영
오늘 나눌 이야기
19. [2000-00-00 00:00:00,001] INFO Partition [__consumer_offsets,19] on broker 5: Shrinking ISR for
partition [__consumer_offsets,19] from 3,4,5 to 5 (kafka.cluster.Partition)
[2000-00-00 00:00:00,002] INFO Partition [__consumer_offsets,29] on broker 5: Shrinking ISR for
partition [__consumer_offsets,29] from 4,5,6 to 5 (kafka.cluster.Partition)
[2000-00-00 00:00:00,003] INFO Partition [__consumer_offsets,9] on broker 5: Shrinking ISR for
partition [__consumer_offsets,9] from 3,5,2 to 5 (kafka.cluster.Partition)
22. 카프카 버전 업그레이드
‣ 다운타임을 가질 수 있는 환경
‣ 전체 브로커 종료 후 버전 업그레이드 진행
‣ 다운타임을 가질 수 없는 환경
‣ 클러스터내 브로커 한대씩 버전 업그레이드를 진행
‣ 카카오에서는..
‣ 크리티컬 이슈가 발생하거나 신규 기능이 추가되는 경우
다운타임없이 버전 업그레이드 진행
27. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
28. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
29. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
30. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
31. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
32. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
33. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
peter-topic
message: C
34. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
peter-topic
message: C
35. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
peter-topic
message: C
36. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
peter-topic
message: C
peter-topic
message: D
37. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: C
peter-topic
message: D
peter-topic
message: B
peter-topic
message: C
peter-topic
message: D
peter-topic
message: B
peter-topic
message: C
peter-topic
message: D
38. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
peter-topic
message: C
39. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: B
peter-topic
message: B
peter-topic
message: C
peter-topic
message: D
40. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: D
peter-topic
message: D
peter-topic
message: D
41. 카프카 클러스터
RACK1 RACK2 RACK3
Broker1 Broker2 Broker3
peter-topic
message: A
peter-topic
message: A
peter-topic
message: A
peter-topic
message: D
peter-topic
message: D
peter-topic
message: D
서비스의 영속성, 데이터 정합성
44. 프로듀서
‣ 프로듀서는 파티션의 리더로 직접 메시지를 전송
‣ 특정 파티션 또는 랜덤 파티션으로 전송
‣ 빠른 전송 속도 보장
‣ 효율성이 좋은 배치 처리 가능
‣ 설정을 통해 배치 크기나 지연시간 조정
45. 프로듀서 ACKS
‣ ACKS = 0
‣ 매우 빠르게 전송할 수 있지만, 파티션의 리더가 받았는지 알 수 없음
‣ ACKS = 1(Strongly Recommend)
‣ 메시지 전송도 빠른편이고, 파티션의 리더가 받았는지 확인
‣ 가장 많이 사용되고, 최근 대부분의 기본값으로 사용
‣ ACKS = ALL
‣ 메시지 전송 속도는 가장 느리지만, 손실 없는 메시지 전송 가능
51. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A message: A message: A
message: B
52. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A message: A message: A
message: B
ack
53. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A message: A message: A
message: B
ack
54. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A message: A message: A
message: B
ack
55. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A
message: B
message: Amessage: A
56. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A
message: B
message: Amessage: A
message: C
57. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A
message: B
message: Amessage: A
message: C
ack
message: C
58. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A
message: B
message: Amessage: A
message: Cmessage: C
message: D
59. Broker1 Broker2 Broker3
프로듀서 ack=1
peter-topic peter-topic peter-topic
message: A
message: C
message: Amessage: A
message: Cmessage: C
message: Dmessage: Dmessage: D
62. Topic: peter-topic, Partition: 1, Offset: 33, Key: a, Received message: Apache Kafka is 1
Topic: peter-topic, Partition: 1, Offset: 34, Key: a, Received message: Apache Kafka is 2
Topic: peter-topic, Partition: 1, Offset: 35, Key: a, Received message: Apache Kafka is 3
Topic: peter-topic, Partition: 1, Offset: 36, Key: a, Received message: Apache Kafka is 4
Topic: peter-topic, Partition: 1, Offset: 37, Key: a, Received message: Apache Kafka is 5
63. Topic: peter-topic, Partition: 1, Offset: 31, Key: None, Received message: Apache Kafka is 9
Topic: peter-topic, Partition: 1, Offset: 32, Key: None, Received message: Apache Kafka is 10
Topic: peter-topic, Partition: 0, Offset: 23, Key: None, Received message: Apache Kafka is 1
Topic: peter-topic, Partition: 0, Offset: 24, Key: None, Received message: Apache Kafka is 4
Topic: peter-topic, Partition: 0, Offset: 25, Key: None, Received message: Apache Kafka is 7