如何彻底清除Apache·Kafka?

63lcw9qa  于 2021-06-06  发布在  Kafka
关注(0)|答案(1)|浏览(334)

我正在使用apachekafka进行springjava微服务的消息传递。有时我想完全重置我的kafka集群(zookeeper和broker),这样我就知道我有一个干净的列表可以测试。然而,我的经纪人似乎仍然知道很多应该删除的东西。
环境是windows10,我正在运行cygwin的kafka v2.12.2。
以下是我当前重置Kafka设置的过程:
阻止经纪人
停止Zookeeper
删除数据目录
重新启动zookeeper
重新启动代理
此时,我看到代理日志显示了对加载偏移量和使用者组的引用。
例如:

[2018-10-23 09:38:49,118] INFO Replica loaded for partition __consumer_offsets-0 with initial high watermark 0 (kafka.cluster.Replica)
[2018-10-23 09:38:49,120] INFO [Partition __consumer_offsets-0 broker=0] __consumer_offsets-0 starts at Leader Epoch 0 from offset 0. Previous Leader Epoch was: -1 (kafka.cluster.Partition)

以及:

[2018-10-23 09:38:49,171] INFO Replica loaded for partition __consumer_offsets-23 with initial high watermark 0 (kafka.cluster.Replica)
[2018-10-23 09:38:49,172] INFO [Partition __consumer_offsets-23 broker=0] __consumer_offsets-23 starts at Leader Epoch 0 from offset 0. Previous Leader Epoch was: -1 (kafka.cluster.Partition)
[2018-10-23 09:38:49,174] INFO Replica loaded for partition __consumer_offsets-1 with initial high watermark 0 (kafka.cluster.Replica)
[2018-10-23 09:38:49,174] INFO [Partition __consumer_offsets-1 broker=0] __consumer_offsets-1 starts at Leader Epoch 0 from offset 0. Previous Leader Epoch was: -1 (kafka.cluster.Partition)

以及:

[2018-10-23 09:38:49,304] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-46 (kafka.coordinator.group.GroupMetadataManager)
[2018-10-23 09:38:49,304] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-49 (kafka.coordinator.group.GroupMetadataManager)
[2018-10-23 09:38:49,304] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-41 (kafka.coordinator.group.GroupMetadataManager)
[2018-10-23 09:38:49,305] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-44 (kafka.coordinator.group.GroupMetadataManager)
[2018-10-23 09:38:49,305] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-47 (kafka.coordinator.group.GroupMetadataManager)
[2018-10-23 09:38:49,305] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-1 (kafka.coordinator.group.GroupMetadataManager)
[2018-10-23 09:38:49,306] INFO [GroupMetadataManager brokerId=0] Scheduling loading of offsets and group metadata from __consumer_offsets-4 (kafka.coordinator.group.GroupMetadataManager)

编辑#1:
下面是我的财产档案中的几行。如果我删除'c:\tool\kafka\data',我仍然会看到与上面类似的日志记录。
zookeeper.properties属性

dataDir=C:/tools/kafka/data/zookeeper

服务器属性

log.dirs=C:/tools/kafka/data/kafka-logs
s8vozzvw

s8vozzvw1#

原来,我有一个进程仍然连接到集群,这导致集群启动后偏移量被重建。
确保110%的进程都已完成,删除数据目录的工作正常。

相关问题