kafka-consumer-groups.sh 命令可以查看消费者组,其中console-consumer-89657是消费的时候如果不设置消费者组自动生成的默认组

[root@mypc01 config]# kafka-consumer-groups.sh \
> --new-consumer \
> --bootstrap-server mypc01:9092,mypc02:9092,mypc03:9092 \
> --list
The [new-consumer] option is deprecated and will be removed in a future major release.The new consumer is used by default if the [bootstrap-server] option is provided.
Note: This will not show information about old Zookeeper-based consumers.
console-consumer-89657
console-consumer-25399
console-consumer-92059
console-consumer-45548
console-consumer-3458
g2

还可以省略new-consumer 参数

kafka-consumer-groups.sh \
--bootstrap-server mypc01:9092,mypc02:9092,mypc03:9092 \
--list

查看消费情况,用describe参数+ 指定消费者组,消费者组可以用上面的方法查

[root@mypc01 config]# kafka-consumer-groups.sh \
> --bootstrap-server mypc01:9092,mypc02:9092,mypc03:9092 \
> --describe \
> --group console-consumer-45548

TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID     HOST            CLIENT-ID
cat             2          79668           79668           0               -               -               -
cat             1          79686           79686           0               -               -               -
cat             0          79682           79682           0               -               -               -

总结

  • kafka-consumer-groups.sh命令可以查看消费者组以及消费情况
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐