kafka connector rest API 操作
创始人
2025-05-28 23:22:41

关于如何部署debezium请参考以前的博文

  1. Getting Basic Connect Cluster Information
curl http://localhost:8083/
  1. Listing Installed Plugins
curl -s localhost:8083/connector-plugins
  1. Create a Connector Instance
curl -i -X PUT -H  "Content-Type:application/json" \http://localhost:8083/connectors/source-debezium-orders-00/config \-d '{"connector.class": "io.debezium.connector.mysql.MySqlConnector","value.converter": "io.confluent.connect.json.JsonSchemaConverter","value.converter.schemas.enable": "true","value.converter.schema.registry.url": "'$SCHEMA_REGISTRY_URL'","value.converter.basic.auth.credentials.source": "'$BASIC_AUTH_CREDENTIALS_SOURCE'","value.converter.basic.auth.user.info": "'$SCHEMA_REGISTRY_BASIC_AUTH_USER_INFO'","database.hostname": "mysql","database.port": "3306","database.user": "debezium","database.password": "dbz","database.server.id": "42","database.server.name": "asgard","table.whitelist": "demo.orders","database.history.kafka.bootstrap.servers": "'$BOOTSTRAP_SERVERS'","database.history.consumer.security.protocol": "SASL_SSL","database.history.consumer.sasl.mechanism": "PLAIN","database.history.consumer.sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"'$CLOUD_KEY'\" password=\"'$CLOUD_SECRET'\";","database.history.producer.security.protocol": "SASL_SSL","database.history.producer.sasl.mechanism": "PLAIN","database.history.producer.sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"'$CLOUD_KEY'\" password=\"'$CLOUD_SECRET'\";","database.history.kafka.topic": "dbhistory.demo","topic.creation.default.replication.factor": "3","topic.creation.default.partitions": "3","decimal.handling.mode": "double","include.schema.changes": "true","transforms": "unwrap,addTopicPrefix","transforms.unwrap.type": "io.debezium.transforms.ExtractNewRecordState","transforms.addTopicPrefix.type":"org.apache.kafka.connect.transforms.RegexRouter","transforms.addTopicPrefix.regex":"(.*)","transforms.addTopicPrefix.replacement":"mysql-debezium-$1"}'
  1. List Connector Instances
curl -s -X GET "http://localhost:8083/connectors/"
  1. Inspect Config and Status for a Connector
curl -i -X GET -H  "Content-Type:application/json" \http://localhost:8083/connectors/sink-elastic-orders-00/config
  1. Delete a Connector
curl -s -X DELETE "http://localhost:8083/connectors/sink-elastic-orders-00"
  1. Update a Connector
    As mentioned above, if there’s a connector to update, you can use PUT to amend the configuration (see Create a Connector Instance above). Because PUT is used to both create and update connectors, it’s the standard command that you should use most of the time (which also means that you don’t have to completely rewrite your configs).

  2. Inspect Task Details

curl -s -X GET "http://localhost:8083/connectors/source-debezium-orders-00/status" | jq '.'

get failed detail

curl -s -X GET "http://localhost:8083/connectors/source-debezium-orders-00/tasks/0/status" | jq '.'
  1. Restart the Connector and Tasks
curl -s -X POST "http://localhost:8083/connectors/source-debezium-orders-00/restart"

Keep in mind though that restarting the connector doesn’t restart all of its tasks. You will also need to restart the failed task and then get its status again as follows:

curl -s -X POST "http://localhost:8083/connectors/source-debezium-orders-00/tasks/0/restart"curl -s -X GET "http://localhost:8083/connectors/source-debezium-orders-00/tasks/0/status" | jq '.'
  1. Get a List of Topics Used by a Connector
curl -s -X GET "http://localhost:8083/connectors/source-debezium-orders-00/topics" | jq '.'

https://developer.confluent.io/learn-kafka/kafka-connect/rest-api/

相关内容

热门资讯

15.2亿人次跨区域流动!“多... 青岛栈桥。 陈炳衡/摄本报(chinatimes.net.cn)记者张蓓 陈炳衡 北京报道2026年...
美伊释放矛盾信号,亚太股市冲高... 特朗普宣布美国将引导中立国船只通过霍尔木兹海峡,并称美伊谈判取得"非常积极"进展,这一消息在周一亚洲...
“我在地坛”彭明榜:53岁辞职... 这是一份在实体书店持续承压的十年里少见的“逆生长”履历。文|《中国企业家》见习记者 陈浩记者 马吉英...
十年来第一次!苹果讨论“涨价”... 十年来,苹果首次在季报文件中将"涨价"列为应对成本压力的选项。摩根士丹利据此判断,今年9月发布的iP...
魔幻的韩国股市,父母给婴儿开户... “全球资本正从美国的‘金融资产’向非美地区的‘实物资产’进行大规模再平衡。”文 /巴九灵在韩国,一种...