您好,登錄后才能下訂單哦!
這篇文章主要介紹了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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。