728x90
kafka-console-groups.sh 용도
hello-group
이름의 컨슈머 그룹으로 생성된 컨슈머로 hello.kafka
토픽의 데이터를 가져갔다.
- 이를 이 명령어로 확인하는 것.
- 컨슈머 그룹은 따로 생성하는 명령을 날리지 않고 컨슈머를 동작할 때 컨슈머 그룹이름을 지정하면 새로 생생된다.
- 컨슈머 랙? 마지막 레코드의 오프셋과 가져간 레코드의 오프셋의 차
오프셋 리셋
- kafka-console-groups.sh 에서 오프셋 리셋이 가장 큰 기능
- 옵션
- --to-earliest: 가장 처음 오프셋으로 리셋
- --to-latest: 가장 마지막 오프셋으로 리셋
- --to-current: 현시점 기준 오프셋으로 리셋
- --to-datetime:특정 일시로
- --shift-by 현재 컨슈머 오프셋에서 앞뒤로 옮겨서
- 컨슈머 그룹 리스트 보기
- bin/kafka-consumer-groups.sh --bootstrap-server my_kafka:9092 --list hello-group
- bin/kafka-consumer-groups.sh --bootstrap-server my_kafka:9092 --list hello-group
- 특정 그룹 자세히 보기
- bin/kafka-consumer-groups.sh --bootstrap-server my_kafka:9092 --group hello-group --describe
- bin/kafka-consumer-groups.sh --bootstrap-server my_kafka:9092 --group hello-group --describe
- hello.kafka에 7만큼 더 넣어보자
그러면 로그 엔드 오프셋이 20으로 늘어나고 랙이 7이됨. (컨슈머가 7만큼 지연됨.)
-> hello group 컨슈머가 가져가면 랙 없어짐.
(랙이 다시 0으로 됨.)
- bin/kafka-consumer-groups.sh --bootstrap-server my_kafka:9092 --group hello-group --topic hello.kafka --reset-offsets --to-earliest --execute
hello-group
컨슈머 그룹이hello.kafka
토픽에 대해 컨슘하고 있는 오프셋을 가장 처음으로 재설정하여, 컨슈머 그룹이 토픽의 처음부터 데이터를 다시 읽도록
NEW-OFFSET: 새로 설정된 오프셋 값. 0
으로 설정
⭐️ 오프셋 리셋부분이 잘 이해는 안된 것 같음.
'DevOps > Kafka' 카테고리의 다른 글
[카프카 퀴즈] 카프카 cli 퀴즈 (0) | 2024.07.02 |
---|---|
[카프카 프로그래밍] 그 외 커맨드 라인 툴, 카프카 토픽을 만드는 두가지 방법, 카프카 브로커와 로컬 커맨드 라인 툴 버전을 맞춰야 하는 이유 (0) | 2024.07.02 |
[카프카 프로그래밍] kafka-console-producer.sh, kafka-console-consumer.sh (0) | 2024.07.01 |
[카프카 프로그래밍] kafka-configs.sh (0) | 2024.06.30 |
[카프카 프로그래밍] kafka-topics.sh (0) | 2024.06.30 |
댓글