在不停止进程的情况下删除kafka连接主题

Delete the kafka connect topics without stopping the process

我是 运行 分布式模式下的 Kafka connect worker。 (这是一个测试集群),我想重置默认值 connect-* topics,所以在不停止我删除的工作人员的情况下,然后在工作人员重新启动后,我收到此错误。

ERROR [Worker clientId=connect-1, groupId=debezium-cluster1] Uncaught exception in herder work thread, exiting:  (org.apache.kafka.connect.runtime.distributed.DistributedHerder:324)

org.apache.kafka.common.config.ConfigException: 
Topic 'connect-offsets' supplied via the 'offset.storage.topic' property is required to have 'cleanup.policy=compact' to guarantee consistency and durability of source connector offsets, 
but found the topic currently has 'cleanup.policy=delete'. 
Continuing would likely result in eventually losing source connector offsets and problems restarting this Connect cluster in the future. 
Change the 'offset.storage.topic' property in the Connect worker configurations to use a topic with 'cleanup.policy=compact'.

看起来这些主题是自动创建的,可能是工作人员在您中途删除它们时创建的。

您可以按照建议手动将配置更改应用于主题,或者您也可以指定一组新主题供工作人员使用(例如 connect01-)并让工作人员正确地重新创建它们。

在工作人员还在 运行 时删除内部主题听起来很冒险。工人有内部状态,现在不再与 Kafka 代理中的状态相匹配。

更安全的方法是关闭 worker(或至少关闭所有连接器),删除主题,然后重新启动 workers/connectors。