1. 编译对应的版本
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
正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:15927142 (15M) [application/x-gzip]
正在保存至: “apache-doris-0.15.0-incubating-src.tar.gz”
100%[=================================================================================================================================>] 15,927,142 27.7KB/s 用时 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.启动容器
需要做两个目录映射,一个是maven的repository目录,一个是doris源码目录,避免容器挂了之后之前下载或编译的内容丢失。
[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]#
## 启动容器
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.进入docker 容器目录,进行编译
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
执行命令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容器里面或者外面对应的目录)
[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]#
网友评论