业精于勤而荒于嬉,行成于思而毁于随

Kafka命令

Posted on By Jack Sun

常用命令

start zookeeper and kafka

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties

Create a topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
bin/kafka-topics.sh --list --zookeeper localhost:2181

Send some messages

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

Start a consumer

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