1
votes

I am trying to do the setup for mirror maker 2 using my current connect cluster. Based on this documentation it can be done via connect rest api.

https://cwiki.apache.org/confluence/display/KAFKA/KIP-382%3A+MirrorMaker+2.0#KIP-382:MirrorMaker2.0-RunningMirrorMakerinaConnectcluster

I followed the sample sending this PUT request :

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": ".*"
}

but i am getting a method not allowed response error response.

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

The api looks ok if I do a simple GET from the / , returning the version

{
  "version": "2.1.0-cp1",
  "commit": "bda8715f42a1a3db",
  "kafka_cluster_id": "VBo-j1OAQZSN8tO4lMJ0Gg"
}
1
I'm not sure the problem is MirrorMaker. The REST API works the same for all connectors, and if you use :name/config endpoint, then "name" field is not requiredOneCricketeer

1 Answers

3
votes

the PUT method doesnt work, using POST works as the api's documentation shows: https://docs.confluent.io/current/connect/references/restapi.html#get--connectors

Remove the name of the connector from the url as @cricket_007 suggested, and wrap the config with new element like this:

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 .