大数据全系列 教程
1869个小节阅读:468k
目录
408考研
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
查看生产者命令参数
xxxxxxxxxx
[root@node2 ~]# kafka-console-producer.sh
参数 | 值 | 描述 |
---|---|---|
--bootstrap-server | node3:9092 | 连接的 Kafka Broker 主机名称和端口号 |
--topic | topicA | 操作的 topic 名称 |
--batch-size | <Integer: size> | 生成多少条提交一次 |
--version | 查询kafka版本 |
查看版本:
xxxxxxxxxx
[root@node3 ~]# kafka-console-producer.sh --version
3.0.1 (Commit:8e30984f43e64d8b)
生产者端,生成数据:
xxxxxxxxxx
[root@node2 ~]# kafka-console-producer.sh --bootstrap-server node3:9092 --topic topicA
>hello kafka
>hello scala
查看消费者命令参数
xxxxxxxxxx
[root@node3 ~]# kafka-console-consumer.sh
参数 | 值 | 描述 |
---|---|---|
--bootstrap-server | node3:9092 | 连接的 Kafka Broker 主机名称和端口号 |
--topic | topicA | 操作的 topic 名称 |
--from-beginning | 从头开始消费数据 | |
--group | 指定消费者的消费组id | |
--version | 查询kafka版本 |
消费者端,消费数据:
xxxxxxxxxx
# 消费者消费数据,只能消费当前时间节点之后生成的数据
# --bootstrap-server 后面使用node2,3,4:9092 都可以
[root@node3 ~]# kafka-console-consumer.sh --bootstrap-server node4:9092 --topic topicA
test1
# 消费所有数据(包括历史数据)
[root@node4 config]# kafka-console-consumer.sh --bootstrap-server node4:9092 --from-beginning --topic topicA
hello scala
hello kafka
test1