본문 바로가기
개발

[kafka] 자주 사용하는 kafka 명령어

by eun2ce 2022. 9. 29.

topic별 발행된 데이터 개수를 확인

kubectl exec -n namespace kafka-0 -- kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic [topic name]
// 출력 결과는  $TOPIC_NAME:$PARTITION_ID:$OFFSET 형식
 

값 확인

kubectl exec -n [namespace] kafka-0 -- kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic [topic name] --property print.key=true --property key.separator="-" --from-beginning
 

consumer lag 확인

kubectl exec -n namespace kafka-0 -- kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group [group name]