1. 編譯對(duì)應(yīng)的版本
https://doris.apache.org/master/zh-CN/installing/compilation.html
這里選擇 docker15 編譯
2.docker 拉去鏡像
[root@basenode ~]# docker pull apache/incubator-doris:build-env-for-0.15.0
build-env-for-0.15.0: Pulling from apache/incubator-doris
61ccbfd87592: Pull complete
Digest: sha256:adadb9d5bd96182e292d6d770aa46ef5e9c8533136c97b08feba670b79c7240c
Status: Downloaded newer image for apache/incubator-doris:build-env-for-0.15.0
docker.io/apache/incubator-doris:build-env-for-0.15.0
[root@basenode ~]#
3. 下載源碼
wget https://dlcdn.apache.org/incubator/doris/0.15.0-incubating/apache-doris-0.15.0-incubating-src.tar.gz
[root@basenode doris]# wget https://dlcdn.apache.org/incubator/doris/0.15.0-incubating/apache-doris-0.15.0-incubating-src.tar.gz
--2021-12-31 23:15:05-- https://dlcdn.apache.org/incubator/doris/0.15.0-incubating/apache-doris-0.15.0-incubating-src.tar.gz
正在解析主機(jī) dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
正在連接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... 已連接。
已發(fā)出 HTTP 請(qǐng)求忽舟,正在等待回應(yīng)... 200 OK
長(zhǎng)度:15927142 (15M) [application/x-gzip]
正在保存至: “apache-doris-0.15.0-incubating-src.tar.gz”
100%[=================================================================================================================================>] 15,927,142 27.7KB/s 用時(shí) 11m 6s
2021-12-31 23:26:16 (23.4 KB/s) - 已保存 “apache-doris-0.15.0-incubating-src.tar.gz” [15927142/15927142])
jdk 切換
切換到 JDK 8:
$ alternatives --set java java-1.8.0-openjdk.x86_64
$ alternatives --set javac java-1.8.0-openjdk.x86_64
$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0
切換到 JDK 11:
$ alternatives --set java java-11-openjdk.x86_64
$ alternatives --set javac java-11-openjdk.x86_64
$ export JAVA_HOME=/usr/lib/jvm/java-11
4.啟動(dòng)容器
需要做兩個(gè)目錄映射胆敞,一個(gè)是maven的repository目錄漂坏,一個(gè)是doris源碼目錄帆吻,避免容器掛了之后之前下載或編譯的內(nèi)容丟失皿渗。
[root@basenode software]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3c93ac03eb0d apache/incubator-doris:build-env-for-0.15.0 "/bin/bash" 2 hours ago Up 2 hours kind_bassi
d9bae370d24e registry.cn-hangzhou.aliyuncs.com/anoy/yapi "node server/app.js" 8 weeks ago Up 3 hours 0.0.0.0:3001->3000/tcp, :::3001->3000/tcp yapi
4e24002bbc34 mongo "docker-entrypoint.s…" 8 weeks ago Up 3 hours 27017/tcp yapimongo
[root@basenode software]#
## 啟動(dòng)容器
docker run -it -v /root/.m2:/root/.m2 -v /opt/software/doris/apache-doris-0.15.0-incubating-src:/opt/software/doris/apache-doris-0.15.0-incubating-src apache/incubator-doris:build-env-for-0.15.0
5.進(jìn)入docker 容器目錄,進(jìn)行編譯
cd /opt/software/doris/apache-doris-0.15.0-incubating-src
sh build.sh
[INFO] Reactor Summary:
[INFO]
[INFO] doris-fe-common 1.0.0 .............................. SUCCESS [03:35 min]
[INFO] spark-dpp 1.0.0 .................................... SUCCESS [10:38 min]
[INFO] fe-core 3.4.0 ...................................... SUCCESS [04:37 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:01 min
[INFO] Finished at: 2021-12-31T16:29:02Z
[INFO] ------------------------------------------------------------------------
***************************************
Successfully build Doris
***************************************
[root@3c93ac03eb0d apache-doris-0.15.0-incubating-src]#
以上的是doris的整體編譯 需要注意的是drois 編譯需要的jdk 是 jdk11
6.更改flink 版本 修改成 13.5
<properties>
<scala.version>2.12</scala.version>
<flink.version>1.13.5</flink.version>
<libthrift.version>0.13.0</libthrift.version>
<arrow.version>5.0.0</arrow.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-javadoc-plugin.version>3.3.0</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<doris.home>${basedir}/../../</doris.home>
7.要將jdk 切回到1.8(docker容器里面操作)
alternatives --set java java-1.8.0-openjdk.x86_64
alternatives --set javac java-1.8.0-openjdk.x86_64
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
8.編譯 :doris-flink
執(zhí)行命令sh build.sh 或者mvn clean package
(docker容器里面操作)
[INFO] Building jar: /opt/software/doris/apache-doris-0.15.0-incubating-src/extension/flink-doris-connector/target/doris-flink-1.0-SNAPSHOT-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:11 min
[INFO] Finished at: 2021-12-31T17:27:26Z
[INFO] ------------------------------------------------------------------------
*****************************************
Successfully build Flink-Doris-Connector
*****************************************
[root@3c93ac03eb0d flink-doris-connector]#
8.目錄
映射的目錄 的文件夾doris-flink-1.0-SNAPSHOT.jar ((docker容器里面或者外面對(duì)應(yīng)的目錄)
[root@basenode target]# ll
總用量 9328
drwxr-xr-x 3 root root 4096 1月 1 01:27 apidocs
drwxr-xr-x 5 root root 70 1月 1 01:26 classes
-rw-r--r-- 1 root root 1 1月 1 01:26 classes.-522306124.timestamp
-rw-r--r-- 1 root root 7802399 1月 1 01:26 doris-flink-1.0-SNAPSHOT.jar
-rw-r--r-- 1 root root 967626 1月 1 01:27 doris-flink-1.0-SNAPSHOT-javadoc.jar
-rw-r--r-- 1 root root 186312 1月 1 01:26 doris-flink-1.0-SNAPSHOT-sources.jar
drwxr-xr-x 4 root root 39 1月 1 01:26 generated-sources
drwxr-xr-x 3 root root 30 1月 1 01:26 generated-test-sources
-rw-r--r-- 1 root root 51102 1月 1 01:26 jacoco.exec
drwxr-xr-x 2 root root 71 1月 1 01:27 javadoc-bundle-options
drwxr-xr-x 2 root root 28 1月 1 01:26 maven-archiver
-rw-r--r-- 1 root root 18707 1月 1 01:27 maven-javadoc-plugin-stale-data.txt
drwxr-xr-x 3 root root 35 1月 1 01:26 maven-status
-rw-r--r-- 1 root root 502705 1月 1 01:26 original-doris-flink-1.0-SNAPSHOT.jar
drwxr-xr-x 3 root root 20 1月 1 01:26 site
drwxr-xr-x 2 root root 133 1月 1 01:26 surefire-reports
drwxr-xr-x 3 root root 17 1月 1 01:26 test-classes
-rw-r--r-- 1 root root 1 1月 1 01:26 test-classes.1885398542.timestamp
[root@basenode target]# pwd
/opt/software/doris/apache-doris-0.15.0-incubating-src/extension/flink-doris-connector/target
[root@basenode target]#