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

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

相关推荐
softshow10265 分钟前
使用 Windows 子系统 WSL 安装 Ubuntu 22.04
linux·windows·ubuntu
wadesir6 分钟前
简易制作LinuxShell完全指南(深入解析原理、设计与实践步骤)
linux·运维·服务器
水天需0101 小时前
HISTFILE 介绍
linux
CreasyChan1 小时前
VirtualBox 安装 CentOS 7.2
linux·运维·centos
AAA.建材批发刘哥1 小时前
04--C++ 类和对象下篇
linux·c++·经验分享·青少年编程
杰克崔2 小时前
glibc社区提问
linux·运维·服务器·车载系统
山上三树2 小时前
MMU与页表
linux·嵌入式硬件
yueguangni2 小时前
centos7虚拟机nat模式连接不上xshell方法分享
linux·运维·服务器
wadesir2 小时前
解决VSCodeServer在CentOS 7上运行问题:glibc 2.17升级与内核优化指南(2025最新版)
linux·运维·centos
Hello_wshuo2 小时前
锅炉温控系统优化
linux·python·物联网