原来还可以使用DataX进行数据同步
原来还可以使⽤DataX进⾏数据同步
DataX 进⾏数据同步
DataX
⼀、环境要求
推荐 Python 2.6.X
JDK 1.8 及以上,推荐 1.8
⼆、DataX部署
儿童节祝福语大全简短10个字下载解压即可使⽤。
三、新建 Job
本⽂以 MaxCompute 同步⾄ Clickhouse 为例:
1. 安装 Clickhouse 驱动。将 Clickhouse jar 放置⽬录 plugin\writer\rdbmswriter\lib下,同时注册Clickhouse 驱动,修
改datax\plugin\writer\rdbmswriter 下的 plugin.json ⽂件,如下所⽰:
{
"name":"rdbmswriter",
"class":"com.alibaba.ader.rdbmswriter.RdbmsWriter",
"description":"useScene: prod. mechanism: Jdbc connection using the database, execute select sql, retrieve data from the ResultSet. warn: The more you know about the database, the less problems you encounter.",
"developer":"alibaba",
"drivers":[
"ru.yandex.clickhouse.ClickHouseDriver"
]
}
2. 定义 Job
Job ⽂件可以定义任何路径下,我这是在 DataX 的 Job ⽬录下创建了 job.json ⽂件,内容如下:
{
"job":{
"setting":{
"speed":{
"channel":5
},
"errorLimit":{
"record":0,
"percentage":0.02
}
},
"content":[
春节加班哪几天是三倍工资
{
"reader":{
"name":"odpsreader",
"parameter":{
窃格瓦拉"accessId":"accessId",
"accessKey":"accessKey",
"project":"projectName",
"table":"tableName",
"column":[
"*"
],
],
"packageAuthorizedProject":"projectName",
"splitMode":"record",
"odpsServer":"xxx/api",
"tunnelServer":""
}
},
"writer":{
"name":"rdbmswriter",
"parameter":{
送给老婆的生日礼物
"connection":[
{
"jdbcUrl":"jdbc:clickhouse://x:8123/databaseName",
"table":[
"tableName"
]
}
],
"username":"username",
"password":"password",
"table":"tableName",
"column":[
"*"
],
"preSql":[
"TRUNCATE table databaseName.tableName;"
]
}
}
}
]
岭南印象园}
}
上述 Json ⼤概意思是将 MaxCompute 中表 tableName 同步到 Clickhouse 并在同步前清空表,最⼤并发数为 5。如果同步过程中出现异常终⽌同步。
3. 启动 DataX
使⽤ Python 命令执⾏同步
cd{YOUR_DATAX_DIR}
python ../bin/datax.py ../job/job.json企业增资流程

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。