CentOS搭建:DataX
2023/12/31小于 1 分钟
参考:
CentOS搭建:DataX
环境依赖
软件/系统 | 版本 | 包名 | 备注 |
---|---|---|---|
Linux | 7(64) | CentOS | |
JDK8 | 8+ | ||
Python | 2+ | ||
DataX | datax.tar.gz | 官网下载 |
解压缩包
cd /opt/
mkdir datax
mv datax.tar.gz datax/
cd datax/
ll
tar -zxvf datax.tar.gz
运行自检脚本
cd /opt/datax/datax/bin
python datax.py ../job/job.json
报错处理:
[main] WARN ConfigParser - 插件[streamreader,streamwriter]加载失败,1s后重试... Exception:Code:[Common-00], Describe:[您提供的配置文件存在错误信息,请检查您的作业配置 .]
如果需要这个错误,请进入plugin/reader 和 plugin/writer,使用ls -al 命令查看目录,删除里面所有以点开头的文件
cd /opt/datax/datax/plugin/reader/
rm -rf ./._*
cd /opt/datax/datax/plugin/writer/
rm -rf ./._*
再次执行自检脚本
编写启动测试文件
查看配置模板:
cd /opt/datax/datax/bin
python datax.py -r streamreader -w streamwriter
cd /opt/datax/datax/bin
vim stream2stream.json
{
"job": {
"content": [
{
"reader": {
"name": "streamreader",
"parameter": {
"sliceRecordCount": 10,
"column": [
{
"type": "long",
"value": "10"
},
{
"type": "string",
"value": "hello,你好,世界-DataX"
}
]
}
},
"writer": {
"name": "streamwriter",
"parameter": {
"encoding": "UTF-8",
"print": true
}
}
}
],
"setting": {
"speed": {
"channel": 5
}
}
}
}
启动DataX
cd /opt/datax/datax/bin
python datax.py ./stream2stream.json
如下表示成功:
