文章目录
- 1、发布订阅测试
-
- [1.1、创建消费者4并指定组 my_group2](#1.1、创建消费者4并指定组 my_group2)
- 1.2、列出所有的消费者组
- [1.3、查看 my_group2 组的详细信息](#1.3、查看 my_group2 组的详细信息)
- 1.4、发送第六条消息accomplish
-
- [1.4.1、查看 my_group1 组的详细信息](#1.4.1、查看 my_group1 组的详细信息)
- [1.4.2、查看 my_group2 组的详细信息](#1.4.2、查看 my_group2 组的详细信息)
1、发布订阅测试
接着上一篇点对点博客测试
kafka-消费者组-点对点测试博客链接
多个消费者组,每个组都可以消费一次消息
消费者在不同组 就是发布订阅模式
1.1、创建消费者4并指定组 my_group2
clike
[root@localhost ~]# kafka-console-consumer.sh --bootstrap-server 192.168.74.148:9092 --topic my_topic1 --group my_group2
1.2、列出所有的消费者组
clike
[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --list
my_group2
my_group1
1.3、查看 my_group2 组的详细信息
clike
[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --group my_group2 --describe
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
my_group2 my_topic1 0 2 2 0 consumer-my_group2-1-a101354d-34f8-4d3a-83e2-95b4edcab830 /192.168.74.148 consumer-my_group2-1
my_group2 my_topic1 1 1 1 0 consumer-my_group2-1-a101354d-34f8-4d3a-83e2-95b4edcab830 /192.168.74.148 consumer-my_group2-1
my_group2 my_topic1 2 2 2 0 consumer-my_group2-1-a101354d-34f8-4d3a-83e2-95b4edcab830 /192.168.74.148 consumer-my_group2-1
1.4、发送第六条消息accomplish
1.4.1、查看 my_group1 组的详细信息
clike
[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --group my_group1 --describe
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
my_group1 my_topic1 1 1 1 0 consumer-my_group1-1-c2ff5a19-af5c-47fc-9ad9-d6028844f86c /192.168.74.148 consumer-my_group1-1
my_group1 my_topic1 2 3 3 0 consumer-my_group1-1-c6a31cdb-c924-49bb-99da-cf45ffdbefb6 /192.168.74.148 consumer-my_group1-1
my_group1 my_topic1 0 2 2 0 consumer-my_group1-1-19852a4a-9a4e-4b41-b605-0a78530d0cd8 /192.168.74.148 consumer-my_group1-1
1.4.2、查看 my_group2 组的详细信息
clike
[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --group my_group2 --describe
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
my_group2 my_topic1 0 2 2 0 consumer-my_group2-1-a101354d-34f8-4d3a-83e2-95b4edcab830 /192.168.74.148 consumer-my_group2-1
my_group2 my_topic1 1 1 1 0 consumer-my_group2-1-a101354d-34f8-4d3a-83e2-95b4edcab830 /192.168.74.148 consumer-my_group2-1
my_group2 my_topic1 2 3 3 0 consumer-my_group2-1-a101354d-34f8-4d3a-83e2-95b4edcab830 /192.168.74.148 consumer-my_group2-1