kafka命令

1.啓動zookeeper
bin/zookeeper-server-start.sh &

2.啓動kafka
nohup bin/kafka-server-start.sh config/server.properties &
 
3.建立topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
4.查看topic
bin/kafka-topics.sh --list --zookeeper localhost:2181
test
5.發送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 
This is a messageThis is another message
6.查看消息
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
相關文章
相關標籤/搜索