GetKafka
- 카프카 홈페이지 다운로드 후 실행
- 도커 이미지로 컨테이너 실행
- brew로 설치
Zookeeper
# Start the ZooKeeper service
# Note: Soon, ZooKeeper will no longer be required by Apache Kafka.
$ bin/zookeeper-server-start.sh config/zookeeper.properties
# Start the ZooKeeper service
$ bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
Kafka
# Start the Kafka broker service
$ bin/kafka-server-start.sh config/server.properties
# Start the Kafka broker service on background
$ bin/kafka-server-start.sh -daemon config/server.properties
Topic
# 토픽 추가
$ bin/kafka-topics.sh --create --topic test --bootstrap-server localhost:9092
# 토픽 리스트 확인
$ bin/kafka-topics.sh --zookeeper localhost:2181 --list
# ???
$ bin/kafka-topics.sh --describe --topic test --bootstrap-server localhost:9092
Producer
# 콘솔 프로듀서 실행
$ bin/kafka-console-producer.sh --topic test --bootstrap-server localhost:9092
Consumer
# 컨슈머 리스트 확인
$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
# 콘솔 컨슈머 실행
$ bin/kafka-console-consumer.sh --topic test --from-beginning --bootstrap-server localhost:9092