首页 > 解决方案 > 两个(Kafka)S3 连接器不能同时工作

问题描述

我有一个 Kafka Connect 在一个集群(3 个节点)中工作,带有 1 个连接器(主题 - > S3),一切都很好:

root@dev-kafka1 ~]# curl localhost:8083/connectors/s3-postgres/status | jq -r
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   219  100   219    0     0  36384      0 --:--:-- --:--:-- --:--:-- 43800
{
  "name": "s3-postgres",
  "connector": {
    "state": "RUNNING",
    "worker_id": "127.0.0.1:8083"
  },
  "tasks": [
    {
      "state": "RUNNING",
      "id": 0,
      "worker_id": "127.0.0.1:8083"
    },
    {
      "state": "RUNNING",
      "id": 1,
      "worker_id": "127.0.0.1:8083"
    }
  ],
  "type": "sink"
}

但是当我创建另一个连接器时,任务状态总是这样:

[root@dev-kafka1 ~]# curl localhost:8083/connectors/s3-postgres6/status | jq -r
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   109  100   109    0     0  14347      0 --:--:-- --:--:-- --:--:-- 15571
{
  "name": "s3-postgres6",
  "connector": {
    "state": "RUNNING",
    "worker_id": "127.0.0.1:8083"
  },
  "tasks": [],
  "type": "sink"
}

我不知道为什么我在配置中做错了同一个插件的两个连接器不能一起工作,如果我停止运行正常的连接器#1,重新启动后连接器#2,工作正常。有谁知道我应该在配置中改变什么?

标签: apache-kafkaapache-kafka-connectkafka-cluster

解决方案


如果不搜索日志,很难说到底是什么问题,甚至可能暂时将日志更改为调试详细程度,但根据连接器属性,Kafka Connect 可能非常耗内存。

Therefore, I'd suggest running Connect itself on isolated machines from the Kafka brokers, and allowing Connect to take more heap size (the default is 2g in latest versions) by exporting the KAFKA_HEAP_OPTS variable


推荐阅读