들어가며..
- 해당 스크립트는 카프카 Topic에서 메시지를 가져오거나(fetch) 표시(display)할때 주로 사용
- 할 수 있는 작업
- 오직 새 메시지만 읽는 작업
- 모든 메시지를 읽는 작업
모든 메시지 수신
./kafka-console-consumer.sh --topic studytopic2 --from-beginning --bootstrap-server localhost:9092,lo
calhost:9094
- 명령어를 실행시키면 해당 topic의 모든 메시지를 출력한 후
- 명령어를 종료하지 않고 대기하며, 새로운 메시지가 수신되면 출력
새로운 메시지 수신
./kafka-console-consumer.sh --topic studytopic2 --bootstrap-server localhost:9092,localhost:9094
메시지 수신 with key 출력
./kafka-console-consumer.sh --topic studytopic2 --bootstrap-server localhost:9092,localhost:9094 --property print.key=true
+메시지 수신 순서
- 동일 key내에서는 송신자가 보낸 순서대로 메시지를 읽지만,
- 다른 key들은 순서가 보장되지 않음
송신자 | 수신자 |
![]() |
![]() |
'Kafka > CLI' 카테고리의 다른 글
Kafka Producers CLI(kafka-console-producer.sh) - 메시지 전송 (0) | 2024.10.25 |
---|---|
Kafka Topic CLI(kafka-topics.sh) - Topic crud작업 (0) | 2024.10.25 |