1.需要编译安装datax ,目前官网的安装包不支持clickhouse导入
2.新建数据导入clickhouse json文件 /datax/job/mysql2clickhouse.json
{
"job": {
"setting": {
"speed": {
"channel": 1
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "root",
"password": "123456",
"column": [
"id",
"name"
],
"splitPk": "id",
"connection": [
{
"table": [
"data_copy1"
],
"jdbcUrl": [
"jdbc:mysql://192.168.3.175:3306/lyjtest?useUnicode=true&characterEncoding=UTF-8",
]
}
]
}
},
"writer": {
"name": "clickhousewriter",
"parameter": {
"username": "lyj",
"password": "123456",
"column":["id","name"],
"connection": [
{
"jdbcUrl": "jdbc:clickhouse://192.168.3.177:8123/test",
"table":["test"]
}
],
"batchSize": 65536,
"batchByteSize": 134217728,
"dryRun": false,
"writeMode": "insert"
}
}
}
]
}
}
3.执行
python ../bin/datax.py mysql2clickhouse.json