这篇文章主要介绍了datax如何编译安装,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
1.centos系统maven安装参考https://www.cnblogs.com/laoayi/p/12867990.html
1.下载 官网地址: http://maven.apache.org/download.cgi
curl -O https://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
2.解压
tar -zxvf apache-maven-3.6.3-bin.tar.gz
3.修改环境变量
vim /etc/profile
export MAVEN_HOME=/opt/maven/apache-maven-3.6.3 export PATH=$MAVEN_HOME/bin:$PATH修改maven镜像地址
vim /opt/maven/apache-maven-3.6.3/conf/settings.xml
添加如下代码:
<mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> <mirrorOf>central</mirrorOf> </mirror>source /etc/profile //使用环境变量生效
4.查看是否成功安装
mvn -version
[root@ambari-03 maven]# mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/maven/apache-maven-3.6.3
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/local/java/jdk/jdk1.8.0_181/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
2.下载datax源码
安装git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
git --version //查看是否安装成功
git clone git@github.com:alibaba/DataX.git //下载datax源码 权限失败需要登录用户
使用另一种curl方式下载源码
curl -O https://gitee.com/jarynpl/DataX/repository/archive/master.zip
unzip master.zip //解压
3. 通过maven打包:
$ cd {DataX_source_code_home}
$ mvn -U clean package assembly:assembly -Dmaven.test.skip=true
编译失败问题处理 :网址https://github.com/alibaba/datax/issues/676
[ERROR] Failed to execute goal on project clickhousewriter: Could not resolve dependencies for project com.alibaba.datax:clickhousewriter:jar:0.0.1-SNAPSHOT: Could not find artifact com.alibaba.datax:simulator:jar:0.0.1-SNAPSHOT in alimaven (http://maven.aliyun.com/nexus/content/repositories/central/) -> [Help 1]
Clickhousewriter 存在问题,可以在该模块 pom.xml 文件中,注释掉该依赖(该依赖用作测试,代码里面也没有单元测试)
<dependency> <groupId>com.alibaba.datax</groupId> <artifactId>simulator</artifactId> <version>${datax-project-version}</version> <scope>test</scope> </dependency>另外,需要把 ClickhouseWriter.java 中 15行,引入的 ClickHouseType去掉,未识别该类
import ru.yandex.clickhouse.ClickHouseTuple;然后尝试编译成功。
打包成功,日志显示如下:
[INFO] gdbwriter .......................................... SUCCESS [ 2.537 s]
[INFO] cassandrawriter .................................... SUCCESS [ 1.323 s]
[INFO] clickhousewriter ................................... SUCCESS [ 1.416 s]
[INFO] hbase20xsqlreader .................................. SUCCESS [ 5.429 s]
[INFO] hbase20xsqlwriter .................................. SUCCESS [ 1.836 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:07 min
[INFO] Finished at: 2021-01-22T19:24:49+08:00
[INFO] ------------------------------------------------------------------------
打包成功后的DataX包位于 {DataX_source_code_home}/target/datax/datax/ ,
结构如下:
$ cd {DataX_source_code_home} $ ls ./target/datax/datax/ bin conf job lib log log_perf plugin script tmp
感谢你能够认真阅读完这篇文章,希望小编分享的“datax如何编译安装”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。