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是从头消费,不带他是之前的不消费,生产者再创建时消费最新的

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

相关推荐
鸠摩智首席音效师7 分钟前
如何在 Linux 中将文件复制到多个目录 ?
linux·运维·服务器
香蕉你个不拿拿^26 分钟前
Linux进程地址空间解析
linux·运维·服务器
人间打气筒(Ada)33 分钟前
Linux学习~日志文件参考
linux·运维·服务器·学习·日志·log·问题修复
xuhe21 小时前
Claude Code配合Astro + GitHub Pages:为 sharelatex-ce 打造现代化的开源项目宣传页
linux·git·docker·github·浏览器·overleaf
charlie1145141911 小时前
RK3568跑Arch Linux全路程指南(以正点原子的RK3568开发板为例子)
linux·嵌入式·rootfs·教程·环境配置·嵌入式linux·工程实践
爆米花byh2 小时前
在RockyLinux9环境的Doris单机版安装
linux·数据库·database
筱白爱学习4 小时前
RestHighLevelClient详细使用手册
linux·服务器·php
若谷老师4 小时前
21.WSL中部署gnina分子对接程序ds
linux·人工智能·ubuntu·卷积神经网络·gnina·smina
啊辉的科研6 小时前
植物单细胞RNA-seq分析教程3-2025年版
linux·r语言
Norach6 小时前
ubuntu22.04安装ssh-server与realvnc-server
linux·服务器·经验分享·ubuntu·ssh·vnc