Topic 관련 옵션이 궁금할 때: bin/kafka-topics.sh --help (help 명령어)
Topic 생성
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
Topic 목록
bin/kafka-topics.sh --list --bootstrap-server localhost:9092
Topic 상세정보
bin/kafka-topics.sh --describe --topic {topic명} --bootstrap-server localhost:9092
Topic 삭제
bin/kafka-topics.sh --delete --topic {topic명} --bootstrap-server localhost:9092
토픽을 삭제하려면 server.properties의 delete.topic.enable=true 설정으로 가능 + 서버 재시작
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic {topic명}
Consumer 관련 옵션이 궁금할 때: bin/kafka-console-consumer.sh --help (help 명령어)
메세지 소비
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic {topic명} --from-beginning
--from-beginning
- Consumer에서 설정된 offset이 없으므로 가장 최신의 메시지 대신 가장 먼저 도착한 메시지부터 읽도록 하는 옵션