环境准备
- List item
- Linux
- JDK(1.8以上,推荐1.8)
- Python(2或3都可以)
- Apache Maven 3.x (Compile DataX)
下载
wget https://datax-opensource.oss-cn-hangzhou.aliyuncs.com/202308/datax.tar.gz
建立datax 用户
useradd datax ; echo "datax" | passwd --stdin datax;
上传至linux 解压
tar -xzvf datax.tar.gz
测试是否可用
python /home/datax/datax/bin/datax.py /home/datax/datax/job/job.json
查看 Mysql 到Mysql 的模板
python /home/datax/datax/bin/datax.py -r mysqlreader -w mysqlwriter
返回
DataX (DATAX-OPENSOURCE-3.0), From Alibaba !
Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.Please refer to the mysqlreader document:https://github.com/alibaba/DataX/blob/master/mysqlreader/doc/mysqlreader.md Please refer to the mysqlwriter document:https://github.com/alibaba/DataX/blob/master/mysqlwriter/doc/mysqlwriter.md Please save the following configuration as a json file and usepython {DATAX_HOME}/bin/datax.py {JSON_FILE_NAME}.json
to run the job.{"job": {"content": [{"reader": {"name": "mysqlreader", "parameter": {"column": [], "connection": [{"jdbcUrl": [], "table": []}], "password": "", "username": "", "where": ""}}, "writer": {"name": "mysqlwriter", "parameter": {"column": [], "connection": [{"jdbcUrl": "", "table": []}], "password": "", "preSql": [], "session": [], "username": "", "writeMode": ""}}}], "setting": {"speed": {"channel": ""}}}
}
填写模板相印的信息
生成mysql2mysql.json
执行
python {DATAX_HOME}/bin/datax.py {JSON_FILE_NAME}.json