【问题标题】:Kafka Connect - Could not look up partition metadataKafka Connect - 无法查找分区元数据
【发布时间】:2020-06-02 23:44:30
【问题描述】:

在关闭了自动创建主题的 Kafka 集群上运行 Kafka Connect。据我所见,在另一个正在运行的集群上,我们创建了连接配置、连接偏移和连接状态等主题。因此,这些主题在具有相同复制因子和分区的新集群上重新创建。

虽然我有从连接实例到代理的 netcat 并且那里没有连接问题,但我们在启动服务时遇到错误

Could not look up partition metadata for offset backing store topic in allotted period. This could indicate a connectivity issue, unavailable topic partitions, or if this is your first use of the topic it may have taken too long to create

我可以从 connect utils 类看到它在下面抛出的位置。但是已经检查过,这些主题现在已经创建了所以有点丢失了

        producer = createProducer();
        consumer = createConsumer();

        List<TopicPartition> partitions = new ArrayList<>();

        // We expect that the topics will have been created either manually by the user or automatically by the herder
        List<PartitionInfo> partitionInfos = null;
        long started = time.milliseconds();
        while (partitionInfos == null && time.milliseconds() - started < CREATE_TOPIC_TIMEOUT_MS) {
            partitionInfos = consumer.partitionsFor(topic);
            Utils.sleep(Math.min(time.milliseconds() - started, 1000));
        }
        if (partitionInfos == null)
            throw new ConnectException("Could not look up partition metadata for offset backing store topic in" +
                    " allotted period. This could indicate a connectivity issue, unavailable topic partitions, or if" +
                    " this is your first use of the topic it may have taken too long to create

【问题讨论】:

  • 请描述每个主题
  • @cricket_007 我明天会回到笔记本电脑,但从查看文档来看,我认为问题可能是偏移存储主题。我知道它不是使用压缩清理策略创建的。不确定这是否重要?
  • 应该是,默认情况下
  • 不是因为主题是手动创建的,这解决了我的问题。如果您愿意,可以将其发布为答案,我会接受

标签: java apache-kafka apache-kafka-connect


【解决方案1】:

主题是手动创建的,

Kafka Connect 将使用 AdminClient 来初始化自己的主题。没有理由手动进行。

如果这样做,您需要确保设置正确,这些设置都记录在 Confluent 和 Apache Kafka 文档中,用于开始使用 Connect

【讨论】:

  • 我们需要手动执行此操作,因为集群中的主题自动创建已关闭,并且我们没有集群的所有权。再次感谢您似乎在这里回答了所有 Kafka 问题。
  • 同样,AdminClient 会忽略自动创建配置,并且您不需要所有权即可使用 AdminClient API。只有引导服务器的开放端口
  • 很高兴知道,应该完全删除主题并让管理员客户端创建它们。谢谢
猜你喜欢
  • 2017-09-13
  • 1970-01-01
  • 2017-11-28
  • 1970-01-01
  • 2019-11-22
  • 1970-01-01
  • 2021-06-24
  • 2017-04-01
  • 2018-04-06
相关资源
最近更新 更多