kafka设置消费者组

安装部署后

consumer.properties

group.id=test-group

单机测试,自己开俩窗口,一个测试消费者,一个测试生产者(创建消息那步)

创建主题

bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic mytesttopic

查看主题

bin/kafka-topics.sh --list --bootstrap-server localhost:9092 hd-topic

删除消费者

bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic mytopic --delete

查看消费者组

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list

创建消息

kafka-console-producer.sh --bootstrap-server localhost:9092 --topic mytesttopic

> 11111111

出现上边的大于号,就可以输入消息了。

再开启个窗口,消费者角度查看消息

kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic mytesttopic --group test-group --from-beginning

--from-beginning是从头消费,不带他是之前的不消费,生产者再创建时消费最新的

刚开始研究,还不是太明白。只研究了这些基本步骤。

相关推荐
不怕犯错,就怕不做1 天前
RK3562的CPU如何降频及关闭硬件编解码
linux·驱动开发·嵌入式硬件
CoderMeijun1 天前
Linux 文件操作详解:open/read/write/lseek 系统调用
linux·文件操作·系统调用·open·文件描述符
可可西里_X_back1 天前
Linux学习(二)- 驱动开发步骤
linux·驱动开发·学习
Hical_W1 天前
Hical 踩坑实录五部曲(二):MSVC / GCC / Clang 三平台 C++20 编译差异
linux·windows·经验分享·嵌入式硬件·macos·开源·c++20
活蹦乱跳酸菜鱼1 天前
linux ATF BL2执行过程
linux
淡淡烟雨淡淡愁1 天前
安装libreoffice
linux
蜀道山老天师1 天前
云原生监控入门:监控基础概念 + SLI/SLO/SLA 详解 + Prometheus 从零安装配置
linux·运维·云原生·prometheus
AIDF20261 天前
linux 服务器网络问题排查
linux·服务器·网络
楼兰公子1 天前
br_opi5_plus_defconfig 附带uboot
linux·运维·服务器
mzhan0171 天前
Linux: signal: SIGALRM; alarm: ITIMER_REAL
linux·运维·服务器