Press "Enter" to skip to content

Kafka修改某个客户端消费的主题的偏移量

./kafka-consumer-groups.sh  --bootstrap-server localhost:9092  --group consumerGroupId  --describe

./kafka-consumer-groups.sh  --bootstrap-server localhost:9092  --group consumerGroupId  --topic my-topic --reset-offsets --to-latest --execute

主要是用 kafka-consumer-groups.sh 这个指令。

--bootstrap-server localhost:9092 --group consumerGroupId 主要是指定要操作的集群和消费者组, –describe可以看到当前消费的主题列表和偏移量情况。

--bootstrap-server localhost:9092 --group consumerGroupId --topic my-topic --reset-offsets --to-latest --execute 指定将目标消费者的偏移量重置到最后。

--to-current Reset offsets to current offset.
--to-datetime Reset offsets to offset from datetime.
Format: 'YYYY-MM-DDTHH:mm:SS.sss'
--to-earliest Reset offsets to earliest offset.
--to-latest Reset offsets to latest offset.
--to-offset Reset offsets to a specific offset.

可以重置的位置可以参考上面的列表。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注