kafka-consumer-groups 명령어로 Consumer Group과 Consumer, Lag 정보 확인
- consumer groups는 consumer가 모두 떠나 empty 상태가 되어도 자동으로 삭제되지 않고 일정 기간동안 보관된다.
kafka-consumer-groups 명령어
- Consumer Group list 정보
- Consumer Group과 Consumer 관계, Partition 등에 대한 상세 정보
- Consumer Group 삭제
- Producer가 전송한 Lag Message 지연 Lag 정보
Consumer Group 리스트 조회
kafka-consumer-groups --bootstrap-server localhost:9092 --list
Consumer Groups가 group_01인 Consumer 1개 생성 후 group_01 상세 확인
Consumer Groups가 group_01인 Consumer 생성
kafka-console-consumer --bootstrap-server localhost:9092 --group group_01 --topic multipart-topic --property print.key=true --property print.partition=true
Consumer Groups가 group_01 상세 확인
- CONSUMER-ID가 모두 console-consumer-182~ 인것을 확인할 수 있다.
kafka-consumer-groups --bootstrap-server localhost:9092 --group group_01 --describe
Consumer Groups가 group_01인 Consumer 1개를 더 생성(총 2개) 후 group_01 상세 확인
Consumer Groups가 group_01인 Consumer 생성
kafka-console-consumer --bootstrap-server localhost:9092 --group group_01 --topic multipart-topic --property print.key=true --property print.partition=true
Consumer Groups가 group_01 상세 확인
- rebalancing 수행 후 CONSUMER-ID가 console-consumer-d57~이 파티션 2번을 할당 받았다.
kafka-consumer-groups --bootstrap-server localhost:9092 --group group_01 --describe
Consumer Groups가 group_01인 Consumer 1개를 더 생성(총 3개) 후 group_01 상세 확인
Consumer Groups가 group_01인 Consumer 생성
kafka-console-consumer --bootstrap-server localhost:9092 --group group_01 --topic multipart-topic --property print.key=true --property print.partition=true
Consumer Groups가 group_01 상세 확인
- rebalancing 수행 후 CONSUMER-ID가 console-consumer-4bf~이 파티션 1번을 할당 받았다.
kafka-consumer-groups --bootstrap-server localhost:9092 --group group_01 --describe
Consumer가 생길 때마다 rebalancing 수행, group_01 상세에서 CONSUMER-ID와 동일한지 확인
- group_01 상세 확인해서 확인한 CONSUMER-ID와 동일한 것을 확인할 수 있다.
생성한 3개의 Consumer가 모두 떠나고 producer 메시지 발행 후 group_01 상세 확인
- Consumer가 모두 떠났기 때문에 앞에서 살펴본 것과 다르게 CONSUMER-ID, HOST, CLIENT-ID가 나타나지 않는다.
메시지 발행 전
메시지 발행 후
- 총 5개의 메시지를 발행하였고, LOG_END_OFFSET, LAG 등이 쌓인 것을 확인할 수 있다.
'kafka > core' 카테고리의 다른 글
카프카 환경 파라미터의 구분 및 kafka-configs 명령어로 파라미터 검색 및 수정 (0) | 2025.04.27 |
---|---|
kafka-consumer-groups 명령어로 Consumer Group 삭제 (0) | 2025.04.25 |
Consumer Group과 Consumer Rebalancing (0) | 2025.04.22 |
Key가 없는 메시지의 파티션 분배 전략 - 라운드로빈과 스티키 파티셔닝 (0) | 2025.04.21 |
Producer의 객체 직렬화(Serializer) 전송의 이해 (0) | 2025.04.17 |
댓글