kafka connect rest api
1. 获取 Connect Worker 信息
curl -s http://127.0.0.1:8083/ | jq
- lenmom@M1701:~/workspace/software/kafka_2.-2.1./logs$ curl -s http://127.0.0.1:8083/ | jq
- {
- "version": "2.1.0",
- "commit": "809be928f1ae004e",
- "kafka_cluster_id": "NGQRxNZMSY6Q53ktQABHsQ"
- }
2.列出 Connect Worker 上所有 Connector
curl -s http://127.0.0.1:8083/connector-plugins | jq
- lenmom@M1701:~/workspace/software/kafka_2.-2.1./logs$ curl -s http://127.0.0.1:8083/connector-plugins | jq
- [
- {
- "class": "io.confluent.connect.hdfs.HdfsSinkConnector",
- "type": "sink",
- "version": "5.2.1"
- },
- {
- "class": "io.confluent.connect.hdfs.tools.SchemaSourceConnector",
- "type": "source",
- "version": "2.1.0"
- },
- {
- "class": "io.confluent.connect.storage.tools.SchemaSourceConnector",
- "type": "source",
- "version": "2.1.0"
- },
- {
- "class": "io.debezium.connector.mongodb.MongoDbConnector",
- "type": "source",
- "version": "0.9.4.Final"
- },
- {
- "class": "io.debezium.connector.mysql.MySqlConnector",
- "type": "source",
- "version": "0.9.4.Final"
- },
- {
- "class": "io.debezium.connector.oracle.OracleConnector",
- "type": "source",
- "version": "0.9.4.Final"
- },
- {
- "class": "io.debezium.connector.postgresql.PostgresConnector",
- "type": "source",
- "version": "0.9.4.Final"
- },
- {
- "class": "io.debezium.connector.sqlserver.SqlServerConnector",
- "type": "source",
- "version": "0.9.4.Final"
- },
- {
- "class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
- "type": "sink",
- "version": "2.1.0"
- },
- {
- "class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
- "type": "source",
- "version": "2.1.0"
- }
- ]
3.获取 Connector 上 Task 以及相关配置的信息
curl -s http://127.0.0.1:8083/connectors/<Connector名字>/tasks | jq
- lenmom@M1701:~/workspace/software/kafka_2.-2.1./logs$ curl -s localhost:/connectors/inventory-connector/tasks |jq
- [
- {
- "id": {
- "connector": "inventory-connector",
- "task":
- },
- "config": {
- "connector.class": "io.debezium.connector.mysql.MySqlConnector",
- "database.user": "root",
- "database.server.id": "",
- "tasks.max": "",
- "database.history.kafka.bootstrap.servers": "127.0.0.1:9092",
- "database.history.kafka.topic": "dbhistory.inventory",
- "database.server.name": "127.0.0.1",
- "database.port": "",
- "task.class": "io.debezium.connector.mysql.MySqlConnectorTask",
- "database.hostname": "127.0.0.1",
- "database.password": "root",
- "name": "inventory-connector",
- "database.whitelist": "inventory"
- }
- }
- ]
4.获取 Connector 状态信息
curl -s http://127.0.0.1:8083/connectors/<Connector名字>/status | jq
- lenmom@M1701:~/workspace/software/kafka_2.-2.1./logs$ curl -s localhost:/connectors/inventory-connector/status |jq
- {
- "name": "inventory-connector",
- "connector": {
- "state": "RUNNING",
- "worker_id": "127.0.0.1:8083"
- },
- "tasks": [
- {
- "state": "RUNNING",
- "id": ,
- "worker_id": "127.0.0.1:8083"
- }
- ],
- "type": "source"
- }
5.获取 Connector 配置信息
curl -s http://127.0.0.1:8083/connectors/<Connector名字>/config | jq
- lenmom@M1701:~/workspace/software/kafka_2.-2.1./logs$ curl -s localhost:/connectors/inventory-connector/config |jq
- {
- "connector.class": "io.debezium.connector.mysql.MySqlConnector",
- "database.user": "root",
- "database.server.id": "",
- "tasks.max": "",
- "database.history.kafka.bootstrap.servers": "127.0.0.1:9092",
- "database.history.kafka.topic": "dbhistory.inventory",
- "database.server.name": "127.0.0.1",
- "database.port": "",
- "database.hostname": "127.0.0.1",
- "database.password": "root",
- "name": "inventory-connector",
- "database.whitelist": "inventory"
- }
6.暂停 Connector
curl -s -X PUT http://127.0.0.1:8083/connectors/<Connector名字>/pause
7.重启 Connector
curl -s -X PUT http://127.0.0.1:8083/connectors/<Connector名字>/resume
8.删除 Connector
curl -s -X DELETE http://127.0.0.1:8083/connectors/<Connector名字>
9.创建新 Connector (以FileStreamSourceConnector举例)
curl -s -X POST -H "Content-Type: application/json" --data
'{
"name": "hdfs-hive-sink",
"config": {
"connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector",
"tasks.max": "1",
"topics": "127.0.0.1.inventory.customers",
"hdfs.url": "hdfs://127.0.0.1:9000/inventory",
"flush.size": "10",
"format.class":"io.confluent.connect.hdfs.string.StringFormat",
"hive.integration": true,
"hive.database": "inventory",
"hive.metastore.uris": "thrift://127.0.0.1:9083",
"schema.compatibility": "BACKWARD"
}
}'
http://http://127.0.0.1:8083/connectors | jq
- lenmom@M1701:~/workspace/software/kafka_2.-2.1./logs$ curl -H "applicaiton/json" http://127.0.0.1:8083/connectors/hdfs-hive-sink |jq
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- --:--:-- --:--:-- --:--:--
- {
- "name": "hdfs-hive-sink",
- "config": {
- "connector.class": "io.confluent.connect.hdfs.HdfsSinkConnector",
- "format.class": "io.confluent.connect.hdfs.string.StringFormat",
- "flush.size": "",
- "tasks.max": "",
- "topics": "127.0.0.1.inventory.customers",
- "hdfs.url": "hdfs://127.0.0.1:9000/inventory",
- "name": "hdfs-hive-sink"
- },
- "tasks": [
- {
- "connector": "hdfs-hive-sink",
- "task":
- }
- ],
- "type": "sink"
- }
10.更新 Connector配置 (以FileStreamSourceConnector举例)
curl -s -X PUT -H "Content-Type: application/json" --data
'{"connector.class":"org.apache.kafka.connect.file.FileStreamSourceConnector",
"key.converter.schemas.enable":"true",
"file":"demo-file.txt",
"tasks.max":"2",
"value.converter.schemas.enable":"true",
"name":"file-stream-demo-distributed",
"topic":"demo-2-distributed",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter":"org.apache.kafka.connect.json.JsonConverter"}'
http://127.0.0.1:8083/connectors/file-stream-demo-distributed/config | jq
kafka connect rest api的更多相关文章
- 替代Flume——Kafka Connect简介
我们知道过去对于Kafka的定义是分布式,分区化的,带备份机制的日志提交服务.也就是一个分布式的消息队列,这也是他最常见的用法.但是Kafka不止于此,打开最新的官网. 我们看到Kafka最新的定义是 ...
- Streaming data from Oracle using Oracle GoldenGate and Kafka Connect
This is a guest blog from Robin Moffatt. Robin Moffatt is Head of R&D (Europe) at Rittman Mead, ...
- kafka connect 使用说明
KAFKA CONNECT 使用说明 一.概述 kafka connect 是一个可扩展的.可靠的在kafka和其他系统之间流传输的数据工具.简而言之就是他可以通过Connector(连接器)简单.快 ...
- Kafka connect in practice(3): distributed mode mysql binlog ->kafka->hive
In the previous post Kafka connect in practice(1): standalone, I have introduced about the basics of ...
- Hadoop生态圈-Kafka的旧API实现生产者-消费者
Hadoop生态圈-Kafka的旧API实现生产者-消费者 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.旧API实现生产者-消费者 1>.开启kafka集群 [yinz ...
- Kafka: Connect
转自:http://www.cnblogs.com/f1194361820/p/6108025.html Kafka Connect 简介 Kafka Connect 是一个可以在Kafka与其他系统 ...
- kafka connect简介以及部署
https://blog.csdn.net/u011687037/article/details/57411790 1.什么是kafka connect? 根据官方介绍,Kafka Connect是一 ...
- 使用Kafka Connect创建测试数据生成器
在最近的一些项目中,我使用Apache Kafka开发了一些数据管道.在性能测试方面,数据生成总是会在整个活动中引入一些样板代码,例如创建客户端实例,编写控制流以发送数据,根据业务逻辑随机化有效负载等 ...
- Kafka Connect简介
Kafka Connect简介 http://colobu.com/2016/02/24/kafka-connect/#more Kafka 0.9+增加了一个新的特性Kafka Connect,可以 ...
随机推荐
- 学习Spring中遇到关于BeanFactory及测试类的问题
最近在学习Spring,使用的是Spring 5.0.1 学习书本中使用的是4.0 学习书本中使用以下来加载配置文件及设置 Resource resource = new ClassPathResou ...
- Execute to Parse %: 29.76,数据库硬解析过高,监控告警提示数据库硬解析比例过低
客户反馈,Oracle重启库操作后,监控告警出现pin比例低于25% 根据Oracle体系结构的理解,重启库后,硬解析及buffer命中率肯定有一段时间低. 生成不同时段的AWR报告:不要生成rac ...
- border边框属性
边框属性: 边框宽度(border-width):thin.medium.thick.长度值 边框颜色(border-color):颜色.transparent(透明) 边框样式(border-sty ...
- s21day20 python笔记
s21day20 python笔记 一.内容回顾 面向对象的三大特性 封装 函数封装到类 数据封装到对象 继承 多态 二.成员 2.1 类成员 类变量(静态字段) 定义:写在类的下一级,和方法同一级 ...
- cocos creator 刚体卡顿问题(边界会卡住)
**问题描述:**在项目开发中,使用到了刚体, 在搭建地图过程中,发现两个相邻的砖块,即使贴合的再紧密,但星星人在上面走动的时候还是会有很大概率发生卡顿(被两个刚体的边界处卡住).为了解决这个问题,我 ...
- ASP.NET+MVC+EntityFramework快速实现增删改查
本教程已经录制视频,欢迎大家观看我在CSDN学院录制的课程:http://edu.csdn.net/lecturer/944
- vue day4 table
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- github 出现 Permission denied (publickey)
首先,清除所有的key-pairssh-add -Drm -r ~/.ssh删除你在github中的public-key 用下面的命令生成public key $ ssh-keygen -t rsa ...
- 软件开发者路线图梗概&书摘chapter5
恒久学习:整个职业生涯,反馈回路,了解弱点 1.提高带宽:多维度.高效获取知识 博客.关注twitter动态.订阅邮件列表.加入本地用户组.技术大会.联系书的作者.在线教程 从信息的海洋中回到实际软件 ...
- 使用C#的aforge类库识别验证码实例
一: 验证码处理 1. 一般处理原则 这种验证码为什么说跟没有一样,第一点:字体规范工整,第二点:不旋转扭曲粘连,第三点:字体颜色单一,下面看处理步骤. 这里要注意的是,aforge只接受像素格式为 ...