标签:directory 主题 自带 topic actor creat art connect --
1)启动zookeeper
演示用的话,直接启动kafka自带的zookeeper即可:
cd kafkaDirectory/kafka_2.12-2.5.0 bin/zookeeper-server-start.sh config/zookeeper.properties
生产上建议连接到zookeeper集群,需更改配置文件 config/server.properties 里更改zookeeper配置zookeeper.connect=localhost:2181
2) 启动kafka server
cd kafkaDirectory/kafka_2.12-2.5.0 bin/kafka-server-start.sh config/server.properties
3) 主题topic
创建topic : test
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
往test Topic里发送数据:
bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic test
从test Topic里面从头开始消费数据:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
end.
标签:directory 主题 自带 topic actor creat art connect --
原文地址:https://www.cnblogs.com/zhuwenjoyce/p/13172473.html