1、Kafka分为:生产者(producer),消费者(consumer)
2、生产者提交消息,给Kafka集群,然后Kafka集群调用消费者(kafka对消息进行归纳,即topic,也就是说producer发布topic,consumer订阅topic)
kafka通过brew install kafka命令安装;kafka安装路径:/usr/local/Cellar/kafka/
配置文件路径:
/usr/local/etc/kafka/server.properties
/usr/local/etc/kafka/zookeeper.properties
kafka默认端口:9092,zookeeper默认端口:2181
启动命令:(进入bin目录后执行以下命令,启动zookeeper和kafka)
1、./kafka-server-start /usr/local/etc/kafka/server.properties &
2、./zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
查看topic命令: kafka-topics --zookeeper 127.0.0.1:2181 --list
查看topic详情命令: kafka-topics --zookeeper 127.0.0.1:2181 --topic TT-TOPIC --describe
查看消费列表信息: kafka-console-consumer --bootstrap-server 192.168.100.35:9092 --topic TT-TOPIC --from-beginning
网友评论