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

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

相关推荐
Andy杨2 小时前
20250718-1-Kubernetes 应用程序生命周期管理-应用部署、升级、弹性_笔记
linux·docker·容器
写写闲篇儿5 小时前
Python+MongoDB高效开发组合
linux·python·mongodb
一个龙的传说7 小时前
linux 常用命令
linux·服务器·zookeeper
Ching·8 小时前
esp32使用ESP-IDF在Linux下的升级步骤,和遇到的坑Traceback (most recent call last):,及解决
linux·python·esp32·esp_idf升级
子柒s9 小时前
Linux 基础
linux
cui_win9 小时前
Kafka 配置参数详解:ZooKeeper 模式与 KRaft 模式对比
分布式·zookeeper·kafka
MC皮蛋侠客9 小时前
Ubuntu安装Mongodb
linux·mongodb·ubuntu
2201_7534369510 小时前
ubuntu基础搭建
linux·运维·ubuntu
莫到空离11 小时前
LVS三种模式实战
linux·服务器·网络