[关闭]
@zhangyy 2020-09-30T17:08:16.000000Z 字数 6261 阅读 193

CDH6 配置Flink1.10.1 编译与CDH 集成

大数据运维专栏


  • 一: 编译环境包的准备
  • 二: 编译生成包配置
  • 三: 使用编译好的flink 做 CDH的parcels与csd 文件
  • 四: CDH6.3.2 集成 flink 1.10.1

一: 编译环境包的准备

  1. 一、环境
  2. CDH 6.3.2(Hadoop 3.0.0)、Flink 1.10.1Centos7.7Maven 3.6.3Scala-2.12JDK1.8
  3. 二、安装包
  4. 1flink1.10.1 tar
  5. https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.10.1/flink-1.10.1-src.tgz
  6. flink-shaded
  7. https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-shaded-10.0/flink-shaded-10.0-src.tgz
  8. 3maven版本
  9. https://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

二:编译环境部署

  1. tar -zxvf jdk1.8.181.tar.gz
  2. mv jdk1.8.181 /usr/local/jdk
  3. tar -zxvf apache-maven-3.6.3-bin.tar.gz
  4. mv apache-maven-3.6.3 /usr/local/maven
  5. tar -zxvf scala-2.12.2.tgz
  6. mv scala-2.12.2 /usr/local/scala

  1. vim /etc/proflie
  2. ---
  3. JAVA_HOME=/usr/local/java
  4. JRE_HOME=/usr/local/java/jre
  5. PATH=$PATH:/usr/local/java/bin
  6. CLASSPATH=.:/usr/local/java/jre/lib
  7. export PATH JAVA_HOME
  8. export MVN_HOME=/usr/local/maven
  9. export PATH=$MVN_HOME/bin:$PATH
  10. export SCALA_HOME=/usr/local/scala
  11. export PATH=$SCALA_HOME/bin:$PATH
  12. ---

图片.png-39.1kB


  1. 在<mirrors>...... </mirrors> 之间加上:
  2. <mirror>
  3. <id>alimaven</id>
  4. <mirrorOf>central</mirrorOf>
  5. <name>aliyun maven</name>
  6. <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
  7. </mirror>
  8. <mirror>
  9. <id>alimaven</id>
  10. <name>aliyun maven</name>
  11. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  12. <mirrorOf>central</mirrorOf>
  13. </mirror>
  14. <mirror>
  15. <id>central</id>
  16. <name>Maven Repository Switchboard</name>
  17. <url>http://repo1.maven.org/maven2/</url>
  18. <mirrorOf>central</mirrorOf>
  19. </mirror>
  20. <mirror>
  21. <id>repo2</id>
  22. <mirrorOf>central</mirrorOf>
  23. <name>Human Readable Name for this Mirror.</name>
  24. <url>http://repo2.maven.org/maven2/</url>
  25. </mirror>
  26. <mirror>
  27. <id>ibiblio</id>
  28. <mirrorOf>central</mirrorOf>
  29. <name>Human Readable Name for this Mirror.</name>
  30. <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
  31. </mirror>
  32. <mirror>
  33. <id>jboss-public-repository-group</id>
  34. <mirrorOf>central</mirrorOf>
  35. <name>JBoss Public Repository Group</name>
  36. <url>http://repository.jboss.org/nexus/content/groups/public</url>
  37. </mirror>
  38. <mirror>
  39. <id>google-maven-central</id>
  40. <name>Google Maven Central</name>
  41. <url>https://maven-central.storage.googleapis.com
  42. </url>
  43. <mirrorOf>central</mirrorOf>
  44. </mirror>
  45. <!-- 中央仓库在中国的镜像 -->
  46. <mirror>
  47. <id>maven.net.cn</id>
  48. <name>oneof the central mirrors in china</name>
  49. <url>http://maven.net.cn/content/groups/public/</url>
  50. <mirrorOf>central</mirrorOf>
  51. </mirror>
  1. 1、解压tar
  2. wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-shaded-10.0/flink-shaded-10.0-src.tgz
  3. tar -zxvf flink-shaded-10.0-src.tgz
  4. 2、修改pom.xml
  5. vim flink-shaded-10.0/pom.xml
  6. ----
  7. <profile>
  8. <id>vendor-repos</id>
  9. <activation>
  10. <property>
  11. <name>vendor-repos</name>
  12. </property>
  13. </activation>
  14. <!-- Add vendor maven repositories -->
  15. <repositories>
  16. <!-- Cloudera -->
  17. <repository>
  18. <id>cloudera-releases</id>
  19. <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
  20. <releases>
  21. <enabled>true</enabled>
  22. </releases>
  23. <snapshots>
  24. <enabled>false</enabled>
  25. </snapshots>
  26. </repository>
  27. <!-- Hortonworks -->
  28. <repository>
  29. <id>HDPReleases</id>
  30. <name>HDP Releases</name>
  31. <url>https://repo.hortonworks.com/content/repositories/releases/</url>
  32. <snapshots><enabled>false</enabled></snapshots>
  33. <releases><enabled>true</enabled></releases>
  34. </repository>
  35. <repository>
  36. <id>HortonworksJettyHadoop</id>
  37. <name>HDP Jetty</name>
  38. <url>https://repo.hortonworks.com/content/repositories/jetty-hadoop</url>
  39. <snapshots><enabled>false</enabled></snapshots>
  40. <releases><enabled>true</enabled></releases>
  41. </repository>
  42. <!-- MapR -->
  43. <repository>
  44. <id>mapr-releases</id>
  45. <url>https://repository.mapr.com/maven/</url>
  46. <snapshots><enabled>false</enabled></snapshots>
  47. <releases><enabled>true</enabled></releases>
  48. </repository>
  49. </repositories>
  50. </profile>
  51. ----

  1. 3、编译
  2. 先进入到 flink-shaded-10.0文件夹下 执行以下命令:
  3. mvn -T2C clean install -DskipTests -Pvendor-repos -Dhadoop.version=3.0.0-cdh6.3.2 -Dscala-2.12 -Drat.skip=true

图片.png-63.2kB


  1. 生成:flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar
  2. original-flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar
  3. 取到这两个jar
  4. /root/flink-shaded-10.0/flink-shaded-hadoop-2-parent/flink-shaded-hadoop-2-uber/target 下面
  5. mv flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar /root
  6. mv original-flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar /root

图片.png-26.2kB


2.3、编译Flink1.10.1源码

  1. 1、解压tar
  2. wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.10.1/flink-1.10.1-src.tgz
  3. tar -zxvf flink-1.10.1-src.tgz
  4. 2、编译
  5. cd flink-1.10.1
  6. mvn clean install -DskipTests -Dfast -Drat.skip=true -Dhaoop.version=3.0.0-cdh6.3.2 -Pvendor-repos -Dinclude-hadoop -Dscala-2.12 -T10C

图片.png-74.1kB

图片.png-65.6kB

  1. 3、打包编译好的文件
  2. 路径:flink-1.10.1/flink-dist/target/flink-1.10.1-bin
  3. 会生成一个 flink-1.10.1 的文件 编译好的文件
  4. cd flink-1.10.1/flink-dist/target/flink-1.10.1-bin
  5. mv original-flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar flink-1.10.1-bin/lib
  6. tar -zcvf flink-1.10.1-scala2.12-cdh6.3.2.tar.gz flink-1.10.1/
  7. mv flink-1.10.1-scala2.12-cdh6.3.2.tar.gz /root

图片.png-28.6kB


3.1 下载制作Parcel包和CSD文件的脚本

  1. 下载制作 parcelsCSD文件脚本:
  2. git clone https://github.com/Git-Charles/flink-parcel.git

图片.png-17.8kB

  1. cd flink-parcels
  2. mv /root/flink-1.10.1-scala2.12-cdh6.3.2.tar.gz ./
  3. mv flink-1.10.1-scala2.12-cdh6.3.2.tar.gz flink-1.10.1-bin-scala_2.12.tgz
  4. md5um flink-1.10.1-bin-scala_2.12.tgz

图片.png-76.1kB


  1. vim flink-parcel.properties
  2. ----
  3. #FLINK 下载地址
  4. FLINK_URL=http://10.60.1.110/flink-1.10.1-bin-scala_2.12.tgz
  5. FLINK_MD5=f12ae2d502f9822fd2eeb53ad9d30fbd
  6. #flink版本号
  7. FLINK_VERSION=1.10.1
  8. #扩展版本号
  9. EXTENS_VERSION=BIN-SCALA_2.12
  10. #操作系统版本,以centos为例
  11. OS_VERSION=7
  12. #CDH 小版本
  13. CDH_MIN_FULL=5.2.0
  14. CDH_MAX_FULL=6.3.3
  15. #CDH大版本
  16. CDH_MIN=5
  17. CDH_MAX=6
  18. ---

  1. cd flink-parcel
  2. chmod +x bulid.sh
  3. sh bulid.sh parcel

图片.png-42.5kB

图片.png-38.7kB

  1. sh bulid.sh csd_on_yarn

图片.png-62.7kB

图片.png-49kB

  1. bash bulid.sh csd_standalone

图片.png-71.6kB

图片.png-54kB

4.4 生成flink的parcels 与 jar包

  1. mkdir parcels-flink
  2. mv *.jar parcels-flink/
  3. cd FLINK-1.10.1-BIN-SCALA_2.12_build/
  4. mv * ../parcels-flink/
  5. tar -zcvf parcels-flink.tar.gz parcels-flink
  6. 把这个包给下载 下来 CDH6.3.2 下面去集成

图片.png-31.3kB

五: CDH6.3.2 集成 flink 1.10.1

5.1 集成CDH6.3.2

  1. cd /var/www/html/
  2. 上传 parcels-flink.tar.gz 到这个目录下面
  3. tar -zxvf parcels-flinks
  4. cp parcels-flinks
  5. cp -p *.jar /opt/cloudera/csd/
  6. chown -R cloudera-scm:cloudera-scm /opt/cloudera/csd/
  7. service cloudera-scm-server restart

图片.png-33.8kB

图片.png-84.5kB

图片.png-83.9kB

  1. 下载分发/分配/激活 flink

图片.png-35.1kB

图片.png-94.8kB


  1. 关于taskmanager.cpu.cores 报错问题
  2. cd /opt/cloudera/parcels/FLINK/lib/flink/conf
  3. vim flink-site.xml
  4. ----
  5. taskmanager.cpu.cores: 2
  6. taskmanager.memory.task.heap.size: 512m
  7. taskmanager.memory.managed.size: 512m
  8. taskmanager.memory.network.min: 64m
  9. taskmanager.memory.network.max: 64m
  10. 到最后 加上 然后同步所有主机:
  11. ---
  12. 添加flink on yarn 的服务

图片.png-102.6kB

图片.png-123.6kB

图片.png-38.3kB

图片.png-122.6kB

图片.png-62.1kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注