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/

相关内容

热门资讯

各地多举措激发冰雪消费活力   这个冬天,各地以“冰雪+”为核心的新模式、新场景不断涌现,激发冰雪消费,释放市场活力。  辽宁推...
握手言和!索尼诉腾讯侵权案迎来... 随着加州北区联邦法院的一纸文书落地,2025年游戏圈最引人关注的“仙人斗法”事件也迎来了尾声。揭秘腾...
“免签朋友圈”再扩容,这些老外...   今年以来,“China Travel”(中国游)的热潮在海外社交平台持续升温、频频出圈。  3月...
每日看盘|全球流动性出现新变化... 周五A股市场出现了普涨反弹的态势。其中,上证综指在盘中一度有两波清晰的主动拉升动作,只是跟风买盘不足...
欧盟批准向乌提供900亿欧元,... 当地时间12月19日凌晨,欧洲理事会主席科斯塔在比利时布鲁塞尔举行的新闻发布会上称,欧盟已批准202...