@zhangyy
2020-09-30T17:08:16.000000Z
字数 6261
阅读 192
大数据运维专栏
- 一: 编译环境包的准备
- 二: 编译生成包配置
- 三: 使用编译好的flink 做 CDH的parcels与csd 文件
- 四: CDH6.3.2 集成 flink 1.10.1
一、环境
CDH 6.3.2(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
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
tar -zxvf jdk1.8.181.tar.gz
mv jdk1.8.181 /usr/local/jdk
tar -zxvf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 /usr/local/maven
tar -zxvf scala-2.12.2.tgz
mv scala-2.12.2 /usr/local/scala
vim /etc/proflie
---
JAVA_HOME=/usr/local/java
JRE_HOME=/usr/local/java/jre
PATH=$PATH:/usr/local/java/bin
CLASSPATH=.:/usr/local/java/jre/lib
export PATH JAVA_HOME
export MVN_HOME=/usr/local/maven
export PATH=$MVN_HOME/bin:$PATH
export SCALA_HOME=/usr/local/scala
export PATH=$SCALA_HOME/bin:$PATH
---
在<mirrors>...... </mirrors> 之间加上:
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库在中国的镜像 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
1、解压tar包
wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-shaded-10.0/flink-shaded-10.0-src.tgz
tar -zxvf flink-shaded-10.0-src.tgz
2、修改pom.xml
vim flink-shaded-10.0/pom.xml
----
<profile>
<id>vendor-repos</id>
<activation>
<property>
<name>vendor-repos</name>
</property>
</activation>
<!-- Add vendor maven repositories -->
<repositories>
<!-- Cloudera -->
<repository>
<id>cloudera-releases</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- Hortonworks -->
<repository>
<id>HDPReleases</id>
<name>HDP Releases</name>
<url>https://repo.hortonworks.com/content/repositories/releases/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<repository>
<id>HortonworksJettyHadoop</id>
<name>HDP Jetty</name>
<url>https://repo.hortonworks.com/content/repositories/jetty-hadoop</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<!-- MapR -->
<repository>
<id>mapr-releases</id>
<url>https://repository.mapr.com/maven/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
</repositories>
</profile>
----
3、编译
先进入到 flink-shaded-10.0文件夹下 执行以下命令:
mvn -T2C clean install -DskipTests -Pvendor-repos -Dhadoop.version=3.0.0-cdh6.3.2 -Dscala-2.12 -Drat.skip=true
生成:flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar
original-flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar
取到这两个jar 包
/root/flink-shaded-10.0/flink-shaded-hadoop-2-parent/flink-shaded-hadoop-2-uber/target 下面
mv flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar /root
mv original-flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.2-10.0.jar /root
1、解压tar包
wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.10.1/flink-1.10.1-src.tgz
tar -zxvf flink-1.10.1-src.tgz
2、编译
cd flink-1.10.1
mvn clean install -DskipTests -Dfast -Drat.skip=true -Dhaoop.version=3.0.0-cdh6.3.2 -Pvendor-repos -Dinclude-hadoop -Dscala-2.12 -T10C
3、打包编译好的文件
路径:flink-1.10.1/flink-dist/target/flink-1.10.1-bin
会生成一个 flink-1.10.1 的文件 编译好的文件
cd flink-1.10.1/flink-dist/target/flink-1.10.1-bin
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
tar -zcvf flink-1.10.1-scala2.12-cdh6.3.2.tar.gz flink-1.10.1/
mv flink-1.10.1-scala2.12-cdh6.3.2.tar.gz /root
下载制作 parcels的CSD文件脚本:
git clone https://github.com/Git-Charles/flink-parcel.git
cd flink-parcels
mv /root/flink-1.10.1-scala2.12-cdh6.3.2.tar.gz ./
mv flink-1.10.1-scala2.12-cdh6.3.2.tar.gz flink-1.10.1-bin-scala_2.12.tgz
md5um flink-1.10.1-bin-scala_2.12.tgz
vim flink-parcel.properties
----
#FLINK 下载地址
FLINK_URL=http://10.60.1.110/flink-1.10.1-bin-scala_2.12.tgz
FLINK_MD5=f12ae2d502f9822fd2eeb53ad9d30fbd
#flink版本号
FLINK_VERSION=1.10.1
#扩展版本号
EXTENS_VERSION=BIN-SCALA_2.12
#操作系统版本,以centos为例
OS_VERSION=7
#CDH 小版本
CDH_MIN_FULL=5.2.0
CDH_MAX_FULL=6.3.3
#CDH大版本
CDH_MIN=5
CDH_MAX=6
---
cd flink-parcel
chmod +x bulid.sh
sh bulid.sh parcel
sh bulid.sh csd_on_yarn
bash bulid.sh csd_standalone
mkdir parcels-flink
mv *.jar parcels-flink/
cd FLINK-1.10.1-BIN-SCALA_2.12_build/
mv * ../parcels-flink/
tar -zcvf parcels-flink.tar.gz parcels-flink
把这个包给下载 下来 去CDH6.3.2 下面去集成
五: CDH6.3.2 集成 flink 1.10.1
cd /var/www/html/
上传 parcels-flink.tar.gz 到这个目录下面
tar -zxvf parcels-flinks
cp parcels-flinks
cp -p *.jar /opt/cloudera/csd/
chown -R cloudera-scm:cloudera-scm /opt/cloudera/csd/
service cloudera-scm-server restart
下载分发/分配/激活 flink
关于taskmanager.cpu.cores 报错问题
cd /opt/cloudera/parcels/FLINK/lib/flink/conf
vim flink-site.xml
----
taskmanager.cpu.cores: 2
taskmanager.memory.task.heap.size: 512m
taskmanager.memory.managed.size: 512m
taskmanager.memory.network.min: 64m
taskmanager.memory.network.max: 64m
到最后 加上 然后同步所有主机:
---
添加flink on yarn 的服务