【问题标题】:install a connector to kafka connect using rest API使用rest API安装连接器到kafka connect
【发布时间】:2020-01-20 21:11:15
【问题描述】:

我想使用 apache Kafka Connect Rest API 将连接器添加到我的本地 Kafka 集群。 你知道任何例子可以做到这一点,拜托。 谢谢

【问题讨论】:

  • 你试过搜索connect rest api吗?

标签: apache-kafka apache-kafka-connect


【解决方案1】:

Confluent's documentation 包含一个关于如何通过 Kafka REST API 添加连接器的清晰示例:

POST /connectors

创建一个新的连接器,返回当前的 连接器信息(如果成功)。

如果在重新平衡中,则返回 409(冲突) 过程。

示例请求:

POST /connectors HTTP/1.1
Host: connect.example.com
Content-Type: application/json
Accept: application/json

{
    "name": "hdfs-sink-connector",
    "config": {
        "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector",
        "tasks.max": "10",
        "topics": "test-topic",
        "hdfs.url": "hdfs://fakehost:9000",
        "hadoop.conf.dir": "/opt/hadoop/conf",
        "hadoop.home": "/opt/hadoop",
        "flush.size": "100",
        "rotate.interval.ms": "1000"
    }
}

示例响应:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "name": "hdfs-sink-connector",
    "config": {
        "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector",
        "tasks.max": "10",
        "topics": "test-topic",
        "hdfs.url": "hdfs://fakehost:9000",
        "hadoop.conf.dir": "/opt/hadoop/conf",
        "hadoop.home": "/opt/hadoop",
        "flush.size": "100",
        "rotate.interval.ms": "1000"
    },
    "tasks": [
        { "connector": "hdfs-sink-connector", "task": 1 },
        { "connector": "hdfs-sink-connector", "task": 2 },
        { "connector": "hdfs-sink-connector", "task": 3 }
    ]
}
GET /

【讨论】:

  • Connect 插件无法通过 API 添加到集群中
猜你喜欢
  • 1970-01-01
  • 2019-10-08
  • 2020-11-20
  • 2021-07-06
  • 2019-04-24
  • 2020-05-01
  • 1970-01-01
  • 2020-01-26
  • 2018-08-27
相关资源
最近更新 更多