
管理
Kafka
|
143
# kafka-run-class.sh kafka.tools.ExportZkOffsets
--zkconnect zoo1.example.com:2181/kafka-cluster --group testgroup
--output-file offsets
# cat offsets
/consumers/testgroup/offsets/my-topic/0:8905
/consumers/testgroup/offsets/my-topic/1:8915
/consumers/testgroup/offsets/my-topic/2:9845
/consumers/testgroup/offsets/my-topic/3:8072
/consumers/testgroup/offsets/my-topic/4:8008
/consumers/testgroup/offsets/my-topic/5:8319
/consumers/testgroup/offsets/my-topic/6:8102
/consumers/testgroup/offsets/my-topic/7:12739
#
2.
导入偏移量
偏移量导入工具与导出工具做的事情刚好相反,它使用之前导出的文件来重置消费者群组
的偏移量。一般情况下,我们会导出消费者群组的当前偏移量,并将导出的文件复制一份
(这样就有了一个备份),然后修改复制文件里的偏移量。这里要注意,在使用导入命令 ...