본문 바로가기

Open Source/Kafka

Kafka Topick생성

kafka 명령어를 사용하기 위해 kafka home로 설정되어 있는 /opt/kafka/bin로 이동한다.

Topic 생성하기

./kafka-topics.sh --bootstrap-server localhost:9092 --topic dreams-topic --create

생성된 Topic 확인

./kafka-topics.sh --bootstrap-server localhost:9092 --list

Producer 데이터 넣기

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

Consumer 데이터 확인

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

 

Producer와 Consumer Cmd창을 따로 띄워 확인해 보자