以下包含了CDH6.2整合Flink1.10编译安装的过程以及趟过的坑,供大家参考、避坑。
CDH 6.2.1(Hadoop 3.0.0)、 Flink 1.10.1、Centos7.7、Maven 3.6.3、Scala-2.12和JDK1.8
1、flink1.10.1 tar包
https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.10.1/flink-1.10.1-src.tgz
2、 flink-shaded
https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-shaded-10.0/flink-shaded-10.0-src.tgz
3、maven版本
https://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
1、下载并解压maven-tar包
命令:tar -zxf apache-maven-3.6.3-bin.tar.gz
2、配置maven环境变量
命令:1、vim /etc/profile
2、source /etc/profile
查看是否配置成功
命令:mvn --version
3、修改setting.xml文件(conf目录下)
配置内容如下:
alimaven
central
aliyun maven
http://maven.aliyun.com/nexus/content/repositories/central/
alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/groups/public/
central
central
Maven Repository Switchboard
http://repo1.maven.org/maven2/
central
repo2
central
Human Readable Name for this Mirror.
http://repo2.maven.org/maven2/
ibiblio
central
Human Readable Name for this Mirror.
http://mirrors.ibiblio.org/pub/mirrors/maven2/
jboss-public-repository-group
central
JBoss Public Repository Group
http://repository.jboss.org/nexus/content/groups/public
google-maven-central
Google Maven Central
https://maven-central.storage.googleapis.com
central
maven.net.cn
oneof the central mirrors in china
http://maven.net.cn/content/groups/public/
central
1、解压tar包
命令:tar -zxvf flink-shaded-10.0-src.tgz
2、修改pom.xml
命令:vim flink-shaded-10.0/pom.xml
配置如下:
vendor-repos
vendor-repos
cloudera-releases
https://repository.cloudera.com/artifactory/cloudera-repos
true
false
HDPReleases
HDP Releases
https://repo.hortonworks.com/content/repositories/releases/
false
true
HortonworksJettyHadoop
HDP Jetty
https://repo.hortonworks.com/content/repositories/jetty-hadoop
false
true
mapr-releases
https://repository.mapr.com/maven/
false
true
3、编译
先进入到 flink-shaded-10.0文件夹下 执行以下命令:
mvn clean install -DskipTests -Pvendor-repos -Dhadoop.version=3.0.0-cdh6.2.1 -Dscala-2.12 -Drat.skip=true -T10C
1、解压tar包
命令:tar -zxvf flink-1.10.1-src.tgz
2、编译
命令1: cd flink-1.10.1
命令2: mvn clean install -DskipTests -Dfast -Drat.skip=true -Dhaoop.version=3.0.0-cdh6.2.1 -Pvendor-repos -Dinclude-hadoop -Dscala-2.12 -T10C
3、打包编译好的文件
路径:flink-1.10.1/flink-dist/target/flink-1.10.1-bin
注意:我们是基于scala2.12编译的,压缩包的名称必须是:flink-1.10.1-bin-scala_2.12.tgz
打包命令:tar -zcf flink-1.10.1-bin-scala_2.12.tgz flink-1.10.1/
1、下载flink-parcel
地址:https://github.com/pkeropen/flink-parcel(里面含有制作过程)
2、将上面打包好的flink-1.10.1-bin-scala_2.12.tgz放到根目录中
3、修改配置文件flink-parcel.properties
#FLINK 下载地址
FLINK_URL=https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.10.1/flink-1.10.1-bin-scala_2.12.tgz
#flink版本号
FLINK_VERSION=1.10.1
#扩展版本号
EXTENS_VERSION=BIN-SCALA_2.12
#操作系统版本,以centos为例
OS_VERSION=7
#CDH 小版本
CDH_MIN_FULL=6.2
CDH_MAX_FULL=6.3
#CDH大版本
CDH_MIN=6
CDH_MAX=6
4、编译parcel
这有个小坑,build.sh文件需要增加可执行的权限
修改权限后 执行成功
5、生成csd文件
on yarn 版本
standalone版本
6、完成flink-parcel制作 查看路径
将上图圈着的部分复制到 /var/www/html/flink-1.10.1
7、查看页面是否可以访问
注意:如果连接访问不了 需要查看httpd服务是否开启或者直接执行 systemctl restart httpd 再刷新页面就可以了
在cdh页面中添加parcel文件的步骤比较简单,这里不再赘述,以下列举我遇到的问题及解决方案,希望能帮到你。
有可能会提示Parcel FLINK-1.10.1-BIN-SCALA_2.12-el7.parcel 的错误:哈希验证失败。
1、文件的哈希值不对,如果不一样就sha1sum后的值更新到.sha文件中
2、如果上图hash值是对的依然上面的错
命令: vim /etc/httpd/conf/httpd.conf
注意:修改后一定要重启httpd服务
命令:systemctl restart httpd
结语:
以上就是我编译Flink1.10.1并部署到CDH的过程及中间遇到的问题,希望可以帮助到你,不足之处,多多海涵,共同学习,共同进步!