Post

Kafka 연습

Kafka 연습

Kafka 연습

mac에서 혼자 kafka를 연습해보았다

참고 링크 : https://ojava.tistory.com/205 https://devocean.sk.com/experts/techBoardDetail.do?ID=163709 + 오류 구글링

카프카 브로커 실행중인지 확인

1
ps -ef | grep kafka

카프카 브로커 실행

1
kafka_2.12-3.7.0/bin/kafka-server-start.sh kafka_2.12-3.7.0/config/server.properties

이후 토픽 만들고,

Kafka의 콘솔 컨슈머를 사용하여 로컬 호스트에서 실행 중인 Kafka 서버의 localhost:9092에 연결하고, kguswo-test01 토픽에서 메시지를 소비하도록 지정하는 명령어

1
kafka_2.12-3.7.0/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kguswo-test01

메시지 생산

1
kafka_2.12-3.7.0/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic kguswo-test01

메시지 소비

1
kafka_2.12-3.7.0/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kguswo-test01 --from-beginning

토픽 목록 조회

1
~/kafka_2.12-3.7.0/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list

kguswo-test01이라는 토픽 생성

1
~/kafka_2.12-3.7.0/bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic kguswo-test01 --partitions 1 --replication-factor 1 --create

토픽 삭제

1
~/kafka_2.12-3.7.0/bin/kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic kguswo-test01

결과화면

카프카 테스트 터미널

This post is licensed under CC BY 4.0 by the author.