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

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

相关推荐
道亦无名24 分钟前
Linux下是STM32的编译修改配置文件tensorflow
linux·运维
炸膛坦客7 小时前
Linux - Ubuntu - PC端:(三)切换中英文,Fcitx5
linux·ubuntu
7yewh7 小时前
jetson_yolo_deployment 01_linux_dev_env
linux·嵌入式硬件·yolo·机器人·嵌入式
cyber_两只龙宝7 小时前
【Haproxy】Haproxy的算法详解及配置
linux·运维·服务器·云原生·负载均衡·haproxy·调度算法
阿常呓语7 小时前
Linux命令 jq详解
linux·运维·shell·jq
学到头秃的suhian8 小时前
消息队列简介及安装
kafka
君生我老8 小时前
Linux 权限
linux
hy____1238 小时前
Linux_网络基础3
linux·服务器·网络
我不听你讲话8 小时前
LNMP网络服务搭建
linux·php·apache
starvapour9 小时前
将Ubuntu设置为不使用独显渲染桌面
linux·ubuntu