kafka简单的启动命令

版权声明:转载请注明文章来源 https://blog.csdn.net/Crystal_1999/article/details/86073928

我这里的安装目录是:/home/bigdata/kafka , 节点名称为 localhadoop1
进入安装目录后输入
bin/kafka-server-start.sh config/server.properties &(后台运行)
bin/kafka-server-start.sh config/server.properties (运行)

启动

生产者模式
bin/kafka-console-producer.sh --broker-list localhadoop1:9092 --topic accesslog
消费者模式
bin/kafka-console-consumer.sh --zookeeper localhadoop1:2181 --from-beginning --topic mobile
创建topic
bin/kafka-topics.sh --create --zookeeper localhadoop1:2181 --replication-factor 1 --partitions 1 --topic mobile
查看当前服务器中的所有topic
bin/kafka-topics.sh --list --zookeeper localhadoop1:2181
查看topic
sh kafka-topics.sh --topic test --describe --zookeeper localhadoop1 :2181
删除topic
bin/kafka-topics.sh --delete --zookeeper localhadoop1:2181 --topic test
需要server.properties中设置delete.topic.enable=true否则只是标记删除或者直接重启。

猜你喜欢

转载自blog.csdn.net/Crystal_1999/article/details/86073928