1、下载压缩包
下载页面地址:https://github.com/alibaba/DataX
不要在【Clone or download】处下载,那里下载的是源码;对于Java不是很在行的人来说,自行编译显得有点困难。
而是在:【Quick Start】--->【Download DataX下载地址】进行下载。下载后的包名:datax.tar.gz。
2、环境依赖:
Centos7
JDK(1.6以上,推荐1.6) = 参考文章:
Python(推荐Python2.6.X) = 系统自动(python2.7)
Apache Maven 3.x (Compile DataX) = 参考文章:
3、 运行DataX
tar -zxvf datax.tar.gz
mv datax /usr/local/
python /usr/local/datax/bin/datax.py /usr/local/datax/job/job.json
4、编辑(/usr/local/datax/job/job.json)文件
{
"job": {
"setting": {
"speed": {
"byte": 10485760
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "admini",
"password": "123456",
"column": ["username", "passwd"],
"connection": [{
"table": [
"user"
],
"jdbcUrl": [
"jdbc:mysql://192.168.60.176:3306/datax"
]
}]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"username": "admini",
"password": "123456",
"column": [
"username",
"passwd"
],
"connection": [{
"jdbcUrl": [
"jdbc:mysql://192.168.60.131:3306/datax"
],
"table": [
"user"
]
}]
}
}
}]
}
}
原文:https://blog.csdn.net/zhouzhiwengang/article/details/87883846
-------------------------------------------------------------------------