Kafka Connect 作为service提供了 REST API 服务
- 管理 Kafka Connector
- Kafka Connect 集群内部通信
常用命令如下:
- 获取 Connector Worker 信息
curl -s <URL>:8083/ | jq
- 创建新 Connector (以FileStreamSourceConnector举例)
curl -s -X POST -H "Content-Type: application/json" --data
'{"name": "<Connector名字>",
"config":
{"connector.class":"org.apache.kafka.connect.file.FileStreamSourceConnector",
"key.converter.schemas.enable":"true",
"file":"demo-file.txt",
"tasks.max":"1",
"value.converter.schemas.enable":"true",
"name":"file-stream-demo-distributed",
"topic":"demo-distributed",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter":"org.apache.kafka.connect.json.JsonConverter"}
}'
http://<Kafka Connect Worker URL>:8083/connectors