kafka笔记

##kafka2.1
[root@cbp1 bin]# ./kafka-topics --create --zookeeper localhost:2181 --replication-factor 3 --partitions 10 --topic t-mytopic 查看topic: [root@cbp1 bin]# ./kafka-topics --zookeeper localhost:2181 --topic t-mytopic --describe

 

##创建topic:
[root@kafka-1 bin]# ./kafka-topics.sh --create --zookeeper 10.41.48.81:2181/kafka --replication-factor 1 --partitions 3 --topic my-topic

##查看topic:
./kafka-topics.sh --zookeeper 10.41.48.81:2181/kafka --list

##生产者:
./kafka-console-producer.sh --broker-list 10.41.48.81:9092 --topic my-topic

##消费者:
 ./kafka-console-consumer.sh --bootstrap-server 10.41.48.81:9092 --topic my-topic --from-beginning

 kafka 2.1

启动zk
zkServer start
启动kafka
brew services start kafka
进入目录创建topic
cd /usr/local/Cellar/kafka/2.1.0 ./bin/kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test1
生产
./bin/kafka-console-producer --broker-list localhost:9092-topic test1
消费topic
./bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic test1 --from-beginning

 

posted @ 2021-03-13 11:24  Simon92  阅读(13)  评论(0编辑  收藏  举报