1 前提条件
编译源码来自https://github.com/apache/doris-flink-connector
,日期2022-08-16
1.1 版本
doris | flink | JDK |
---|---|---|
1.1.1 | 1.14.5 | 1.8 |
1.2 是否独立编译
没有完整编译Doris,而是单独编译模块https://github.com/apache/doris-flink-connector
1.3 thrift安装
1. 安装依赖
yum install -y autoconf automake libtool cmake ncurses-devel openssl-devel lzo-devel zlib-devel gcc gcc-c++
2. 获取thrift-0.13.0.tar.gz,没有wget需安装或下载tar包上传
wget https://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz
3. 解压
tar zxvf thrift-0.13.0.tar.gz
4. 安装thrift,依次执行
cd thrift-0.13.0
./configure --without-tests
make
make instal
5. 安装完成后查看版本
thrift --version
##显示Thrift version 0.13.0
2 doris-flink-connector编译
2.1 源码下载
自己上传也可
git clone https://github.com/apache/doris-flink-connector
目录结构如下
-rw-r--r-- 1 root root 4118 8月 16 14:38 CODE_OF_CONDUCT.md
-rw-r--r-- 1 root root 1117 8月 16 14:38 CONTRIBUTING_CN.md
-rw-r--r-- 1 root root 1170 8月 16 14:38 CONTRIBUTING.md
-rw-r--r-- 1 root root 56 8月 16 14:38 custom_env.sh.tpl
-rwxr-xr-x 1 root root 2706 8月 16 14:38 env.sh
drwxr-xr-x 3 root root 4096 8月 16 14:38 flink-doris-connector
-rw-r--r-- 1 root root 11358 8月 16 14:38 LICENSE.txt
-rw-r--r-- 1 root root 186 8月 16 14:38 NOTICE.txt
-rw-r--r-- 1 root root 3532 8月 16 14:38 README.md
2.2 文件修改
-
修改custom_env.sh.tpl文件,重命名为custom_env.sh
mv custom_env.sh.tpl custom_env.sh
-
需指定Thrift路径,具体位置可以使用
whereis thrift
命令查看export THRIFT_BIN=/xxx/thrift
2.3 开始编译
cd flink-doris-connector
sh build.sh --flink 1.14.5 --scala 2.11
-------------------------报错---------
Could not resolve dependencies for project
org.apache.doris:flink-doris-connector-1.14:jar:1.0.0-SNAPSHOT:
The following artifacts could not be resolved:
org.apache.flink:flink-clients:jar:1.14.5,
org.apache.flink:flink-table-planner-loader:jar:1.14.5,
org.apache.flink:flink-table-api-java-bridge:jar:1.14.5,
org.apache.flink:flink-table-runtime:jar:1.14.5:
Could not find artifact org.apache.flink:flink-clients:jar:1.14.5 in central (https://repo.maven.apache.org/maven2)
报错解决
可以看出是找不到jar包了,可以去具体路径去看一下https://repo.maven.apache.org/maven2/org/apache/flink/,确实没有
发现带上后缀_2.11(我需要的是scala的2.11),是有的,所以更改pom文件
原来 | 更改后 |
---|---|
flink-table-api-java-bridge | flink-table-api-java-bridge_2.11 |
flink-table-runtime | flink-table-runtime_2.11 |
flink-table-planner-loader/ | flink-table-planner_2.11 |
flink-clients | flink-clients_2.11 |
更改后的部分依赖文件
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-runtime_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
3 编译成功
3.1 编译信息
[INFO]
[INFO] --- maven-javadoc-plugin:3.3.0:jar (attach-javadocs) @ flink-doris-connector-1.14 ---
[INFO] Skipping javadoc generation
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:35 min
[INFO] Finished at: 2022-08-16T14:34:56+08:00
[INFO] ------------------------------------------------------------------------
*****************************************
Successfully build Flink-Doris-Connector
*****************************************
3.2 编译后文件
最后编译文件再 target下
总用量 44
-rwxr-xr-x 1 root root 2585 7月 29 15:02 build.sh
-rw-r--r-- 1 root root 13791 8月 16 14:34 dependency-reduced-pom.xml
-rw-r--r-- 1 root root 16587 8月 16 14:14 pom.xml
drwxr-xr-x 4 root root 30 7月 29 15:02 src
drwxr-xr-x 10 root root 4096 8月 16 14:34 target
ll target/
drwxr-xr-x 5 root root 93 8月 16 14:34 classes
-rw-r--r-- 1 root root 7574848 8月 16 14:34 flink-doris-connector-1.14-1.0.0-SNAPSHOT.jar
-rw-r--r-- 1 root root 243285 8月 16 14:34 flink-doris-connector-1.14-1.0.0-SNAPSHOT-sources.jar
drwxr-xr-x 5 root root 54 8月 16 14:34 generated-sources
drwxr-xr-x 3 root root 30 8月 16 14:34 generated-test-sources
drwxr-xr-x 2 root root 28 8月 16 14:34 maven-archiver
drwxr-xr-x 3 root root 22 8月 16 14:34 maven-shared-archive-resources
drwxr-xr-x 3 root root 35 8月 16 14:34 maven-status
-rw-r--r-- 1 root root 571566 8月 16 14:34 original-flink-doris-connector-1.14-1.0.0-SNAPSHOT.jar
drwxr-xr-x 2 root root 4096 8月 16 14:34 surefire-reports
drwxr-xr-x 4 root root 33 8月 16 14:34 test-classes
3.3 编译后文件
链接:https://pan.baidu.com/s/1HUujFShpMc_8iwnIPRA_Aw
提取码:1234
标签:14,16,--,flink,apache,root,doris,connect1.14
From: https://www.cnblogs.com/gcwell/p/16591638.html