Send/Consume some messages using Kafka Console Producer/Consumer

김소은·2026년 1월 23일

Producer

bin/kafka-console-producer.sh

bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic reviews


Consumer

bin/kafka-console-consumer.sh

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic reviews



Consuming messages from the beginning

offset이 없을 땐 가장 최근 메시지부터 읽어오는 것이 default인 것 같다.
이럴 땐 --from-beginning 옵션을 사용해 가장 오래된 메시지부터 읽어온다.

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic reviews --from-beginning

메시지는 consume되어도 계속 저장된 상태로 남는다.

profile
개발자

0개의 댓글