不允许使用kafka connect rest api put方法设置mirror maker 2

68bkxrlz  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(616)

我正在尝试使用当前的connect群集为mirror maker 2进行设置。基于此文档,可以通过connectrestapi完成。
https://cwiki.apache.org/confluence/display/kafka/kip-382%3a+mirrormaker+2.0#kip-382:mirrormaker2.0—运行mirrormaker2群集
我跟踪了发送此put请求的示例:
put/connectors/us-west-source/config http/1.1

{
    "name": "us-west-source",
    "connector.class": "org.apache.kafka.connect.mirror.MirrorSourceConnector",
    "source.cluster.alias": "us-west",
    "target.cluster.alias": "us-east",
    "source.cluster.bootstrap.servers": "us-west-host1:9091",
    "topics": ".*"
}

但是我得到了一个方法不允许的响应错误响应。

{
  "error_code": 405,
  "message": "HTTP 405 Method Not Allowed"
}

如果我从/执行简单的get,并返回版本,那么api看起来就正常了

{
  "version": "2.1.0-cp1",
  "commit": "bda8715f42a1a3db",
  "kafka_cluster_id": "VBo-j1OAQZSN8tO4lMJ0Gg"
}
cigdeys3

cigdeys31#

put方法不起作用,如api文档所示,使用post工作:https://docs.confluent.io/current/connect/references/restapi.html#get--连接器
按照@cricket\u 007的建议,从url中删除连接器的名称,并用新元素 Package 配置,如下所示:

curl --noproxy "*" -XPOST -H 'Content-Type: application/json' -H 'Accept: application/json' http://localhost:8083/connectors -d'{
    "name": "dc-west-source",
    "config": {
    "connector.class": "org.apache.kafka.connect.mirror.MirrorSourceConnector",
    "source.cluster.alias": "dc-west",
    "target.cluster.alias": "dc-east",
    "source.cluster.bootstrap.servers": "dc-west-cp-kafka-0.domain:32721,dc-west-cp-kafka-1.domain:32722,dc-west-cp-kafka-2.dc.domain:32723",
    "topics": ".*" 
    }
}
' | jq .

相关问题