Topic
kafka-topics.sh --zookeeper localhost:2181 --topic first_topic --create --partitions 3 --replication-factor 1
kafka-topics.sh --zookeeper localhost:2181 --topic first_topic --describe
kafka-topics.sh --zookeeper localhost:2181 --list
kafka-topics.sh --zookeeper localhost:2181 --topic second_topic --delete
Producer
kafka-console-producer.sh --broker-list localhost:9092 --topic first_topic
kafka-console-producer.sh --broker-list localhost:9092 --topic first_topic --producer-property acks=all
(토픽을 미리 만들지 않고 Producer에서 --topic 을 설정해 새로운 토픽을 만들 수 있지만, 미리 토픽을 만들고 producing 하는게 좋음... 그렇지 않으면 default 셋팅된 topic 설정값으로 생성됨 -> server.properties 파일에서 default 파티션 수 등 설정 가능)
Consumer
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --from-beginning
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --group my-first-application
Consumer Group
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-first-application
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-first-application --reset-offsets --to-earliest --execute --topic first_topic
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-first-application --reset-offsets --shift-by -2 --execute --topic first_topic