简介:本文将主要介绍 FlinkX 读取和写入 Clickhouse 的过程及相关参数,核心内容将围绕以下3个问题:1. FlinkX读写Clickhouse支持哪个版本?、2. ClickHouse读写Clickhouse有哪些参数?、3. ClickHouse读写Clickhouse参数都有哪些说明?
本文将主要介绍 FlinkX 读取和写入 Clickhouse 的过程及相关参数,核心内容将围绕以下3个问题,FlinkX 插件下载:
https://github.com/DTStack/flinkx
名称:clickhousereader
ClickHouse 19.x及以上
1.读取全部字段,如果字段数量很多,可以使用下面的写法:
"column":["*"]
2.只指定字段名称:
"column":["id","name"]
3.指定具体信息:
"column": [{
"name": "col",
"type": "datetime",
"format": "yyyy-MM-dd hh:mm:ss",
"value": "value"
}]
属性说明:
描述:轮询间隔时间,从数据库中拉取数据的间隔时间,默认为5000毫秒。
必选:否
默认值:5000
{
"job": {
"content": [{
"reader": {
"parameter" : {
"column" : [ {
"name" : "id",
"type" : "bigint",
"key" : "id"
}, {
"name" : "user_id",
"type" : "bigint",
"key" : "user_id"
}, {
"name" : "name",
"type" : "varchar",
"key" : "name"
} ],
"username" : "username",
"password" : "password",
"connection" : [ {
"jdbcUrl" : [ "jdbc:clickhouse://0.0.0.1:8123/dtstack" ],
"table" : [ "tableTest" ]
} ],
"where": "id > 1",
"splitPk": "id",
"fetchSize": 1000,
"queryTimeOut": 1000,
"customSql": "",
"requestAccumulatorInterval": 2
},
"name" : "clickhousereader"
},
"writer": {
"name": "streamwriter",
"parameter": {
"print": true
}
}
}],
"setting": {
"speed": {
"channel": 1,
"bytes": 0
},
"errorLimit": {
"record": 100
}
}
}
}
{
"job": {
"content": [{
"reader": {
"parameter" : {
"column" : [ {
"name" : "id",
"type" : "bigint",
"key" : "id"
}, {
"name" : "user_id",
"type" : "bigint",
"key" : "user_id"
}, {
"name" : "name",
"type" : "varchar",
"key" : "name"
} ],
"username" : "username",
"password" : "password",
"connection" : [ {
"jdbcUrl" : [ "jdbc:clickhouse://0.0.0.1:8123/dtstack" ],
"table" : [ "tableTest" ]
} ],
"where": "id > 1",
"splitPk": "id",
"fetchSize": 1000,
"queryTimeOut": 1000,
"customSql": "",
"requestAccumulatorInterval": 2
},
"name" : "clickhousereader"
},
"writer": {
"name": "streamwriter",
"parameter": {
"print": true
}
}
}],
"setting": {
"speed": {
"channel": 3,
"bytes": 0
},
"errorLimit": {
"record": 100
}
}
}
}
{
"job": {
"content": [{
"reader": {
"parameter" : {
"column" : [ {
"name" : "id",
"type" : "bigint",
"key" : "id"
}, {
"name" : "user_id",
"type" : "bigint",
"key" : "user_id"
}, {
"name" : "name",
"type" : "varchar",
"key" : "name"
} ],
"username" : "username",
"password" : "password",
"connection" : [ {
"jdbcUrl" : [ "jdbc:clickhouse://0.0.0.1:8123/dtstack" ],
"table" : [ "tableTest" ]
} ],
"where": "id > 1",
"splitPk": "id",
"fetchSize": 1000,
"queryTimeOut": 1000,
"customSql": "select id from tableTest",
"requestAccumulatorInterval": 2
},
"name" : "clickhousereader"
},
"writer": {
"name": "streamwriter",
"parameter": {
"print": true
}
}
}],
"setting": {
"speed": {
"channel": 1,
"bytes": 0
},
"errorLimit": {
"record": 100
}
}
}
}
{
"job": {
"content": [{
"reader": {
"parameter" : {
"column" : [ {
"name" : "id",
"type" : "bigint",
"key" : "id"
}, {
"name" : "user_id",
"type" : "bigint",
"key" : "user_id"
}, {
"name" : "name",
"type" : "varchar",
"key" : "name"
} ],
"username" : "username",
"password" : "password",
"connection" : [ {
"jdbcUrl" : [ "jdbc:clickhouse://0.0.0.1:8123/dtstack" ],
"table" : [ "tableTest" ]
} ],
"where": "id > 1",
"splitPk": "id",
"fetchSize": 1000,
"queryTimeOut": 1000,
"customSql": "",
"increColumn": "id",
"startLocation": "20",
"requestAccumulatorInterval": 2
},
"name" : "clickhousereader"
},
"writer": {
"name": "streamwriter",
"parameter": {
"print": true
}
}
}],
"setting": {
"speed": {
"channel": 1,
"bytes": 0
},
"errorLimit": {
"record": 100
}
}
}
}
{
"job": {
"content": [{
"reader": {
"parameter" : {
"column" : [ {
"name" : "id",
"type" : "bigint",
"key" : "id"
}, {
"name" : "user_id",
"type" : "bigint",
"key" : "user_id"
}, {
"name" : "name",
"type" : "varchar",
"key" : "name"
} ],
"username" : "username",
"password" : "password",
"connection" : [ {
"jdbcUrl" : [ "jdbc:clickhouse://0.0.0.1:8123/dtstack" ],
"table" : [ "tableTest" ]
} ],
"where": "id > 1",
"splitPk": "id",
"fetchSize": 1000,
"queryTimeOut": 1000,
"customSql": "",
"requestAccumulatorInterval": 2,
"polling": true,
"pollingInterval": 3000
},
"name" : "clickhousereader"
},
"writer": {
"name": "streamwriter",
"parameter": {
"print": true
}
}
}],
"setting": {
"speed": {
"channel": 1,
"bytes": 0
},
"errorLimit": {
"record": 100
}
}
}
}
名称:clickhousewriter
ClickHouse 19.x及以上
文章来源如下,感兴趣的同学可查看原文:
https://www.aboutyun.com/forum.php?mod=viewthread&tid=29271
更多 Flink 技术问题可在钉钉群交流
原文链接:https://developer.aliyun.com/article/770821?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。