brew로 kafka 설치

brew install kafka

services start

brew services start zookeeper
brew services start kafka

카프카로 이동

brew info kafka → kafka 위치 찾기

cd /opt/homebrew/Cellar/kafka/3.4.0/bin

TOPIC 만들기 (localhost:9092에 만들기)

./kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 -partitions 1 --topic kafka-test

TOPIC 리스트 확인

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

만들어둔 TOPIC에 데이터 넣기

./kafka-console-producer --broker-list localhost:9092 --topic kafka-test
방법2
./kafka-console-producer.sh --topic kafka-test --bootstrap-server localhost:9092

입력데이터

hello

kafka

consumer에서 가져오기

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