flink on yarn 測(cè)試環(huán)境搭建

flink on yarn 測(cè)試環(huán)境搭建

軟件版本

hadoop 2.7.3

flink 0.8.0

jdk-8u171-linux-x64

tar -zxvf jdk-8u171-linux-x64.tar.gz

mv jdk1.8.0_171/ /opt/jdk

tar -zxvf hadoop-2.7.3.tar.gz

mv hadoop-2.7.3/ /opt/hadoop

tar -zxvf apache-maven-3.6.3-bin.tar.gz

mv apache-maven-3.6.3/ /opt/maven

vi /opt/maven/conf/settings.xml

<mirror>

? ? <id>aliyunmaven</id>

? ? <mirrorOf>*</mirrorOf>

? ? <name>阿里云公共倉庫</name>

? ? <url>https://maven.aliyun.com/repository/public</url>

</mirror>

vi .bashrc

export JAVA_HOME=/opt/jdk

export M2_HOME=/opt/maven

export HADOOP_HOME=/opt/hadoop

export FLINK_HOME=/opt/flink

export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$FLINK_HOME/bin

編譯 flink

tar -zxvf flink-0.8.0-src.tgz

cd flink-0.8.0

mvn clean install -DskipTests -Dhadoop.version=2.7.3

復(fù)制 flink on yarn 到 /opt 目錄

cp flink-dist/target/flink-0.8.0-bin/flink-yarn-0.8.0/? /opt/flink

配置 hdfs

mkdir /opt/namenode

mkdir /opt/datanode

vi /opt/hadoop/etc/hadoop/core-site.xml

? ? <property>

? ? ? ? <name>fs.defaultFS</name>

? ? ? ? <value>hdfs://localhost:9000</value>

? ? </property>

? ? <property>

? ? ? ? <name>file.blocksize</name>

? ? ? ? <value>134217728</value>

? ? </property>

? ? <property>

? ? ? ? <name>hadoop.tmp.dir</name>

? ? ? ? <value>/tmp/hadoop</value>

? ? </property>

vi /opt/hadoop/etc/hadoop/hdfs-site.xml

? ? <property>

? ? ? ? <name>dfs.replication</name>

? ? ? ? <value>1</value>

? ? </property>

? ? <property>

? ? ? ? <name>dfs.datanode.handler.count</name>

? ? ? ? <value>5</value>

? ? </property>

? ? <property>

? ? ? ? <name>dfs.namenode.handler.count</name>

? ? ? ? <value>5</value>

? ? </property>

? ? <property>

? ? ? ? <name>dfs.namenode.service.handler.count</name>

? ? ? ? <value>5</value>

? ? </property>

? ? <property>

? ? ? ? <name>dfs.namenode.name.dir</name>

? ? ? ? <value>file:///opt/namenode</value>

? ? </property>

? ? <property>

? ? ? ? <name>dfs.datanode.data.dir</name>

? ? ? ? <value>file:///opt/datanode</value>

? ? </property>

? ? <property>

? ? ? ? <name>dfs.image.compress</name>

? ? ? ? <value>true</value>

? ? </property>

格式化 hdfs

hdfs namenode -format

啟動(dòng) namenode? secondarynamenode? datanode

hadoop-daemon.sh start namenode

hadoop-daemon.sh start secondarynamenode

hadoop-daemon.sh start datanode

配置 yarn

cp /opt/hadoop/etc/hadoop/mapred-site.xml.template /opt/hadoop/etc/hadoop/mapred-site.xml

vi /opt/hadoop/etc/hadoop/mapred-site.xml

? ? <property>

? ? ? ? <name>mapreduce.framework.name</name>

? ? ? ? <value>yarn</value>

? ? </property>

vi /opt/hadoop/etc/hadoop/yarn-site.xml

? ? <property>

? ? ? ? <name>yarn.nodemanager.aux-services</name>

? ? ? ? <value>mapreduce_shuffle</value>

? ? </property>

? ? <property>

? ? ? ? <name>yarn.resourcemanager.hostname</name>

? ? ? ? <value>192.168.14.3</value>

? ? </property>

啟動(dòng) yarn session

yarn-session.sh -jm 2048 -tm 2048 -n 1

15:00:08,071 WARN? org.apache.hadoop.util.NativeCodeLoader? ? ? ? ? ? ? ? ? ? ? - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

15:00:08,214 INFO? org.apache.flink.yarn.Utils? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Could not find HADOOP_CONF_PATH, using HADOOP_HOME.

15:00:08,214 INFO? org.apache.flink.yarn.Utils? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Found configuration using hadoop home.

15:00:08,260 INFO? org.apache.flink.yarn.Client? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Copy App Master jar from local filesystem and add to local environment

15:00:08,852 INFO? org.apache.hadoop.yarn.client.RMProxy? ? ? ? ? ? ? ? ? ? ? ? - Connecting to ResourceManager at /192.168.14.3:8032

Using values:

Container Count = 1

Jar Path = /opt/flink/lib/flink-dist-0.8.0-yarn-uberjar.jar

Configuration file = /opt/flink/conf/flink-conf.yaml

JobManager memory = 2048

TaskManager memory = 2048

TaskManager cores = 1

amCommand=$JAVA_HOME/bin/java -Xmx1638M? -Dlog.file="<LOG_DIR>/jobmanager-main.log" -Dlogback.configurationFile=file:logback.xml -Dlog4j.configuration=file:log4j.properties org.apache.flink.yarn.appMaster.ApplicationMaster? 1><LOG_DIR>/jobmanager-stdout.log 2><LOG_DIR>/jobmanager-stderr.log

15:00:09,107 INFO? org.apache.flink.yarn.Utils? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Copying from file:/opt/flink/lib/flink-dist-0.8.0-yarn-uberjar.jar to hdfs://localhost:9000/user/root/.flink/application_1588744655039_0008/flink-dist-0.8.0-yarn-uberjar.jar

15:00:10,173 INFO? org.apache.flink.yarn.Utils? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Copying from /opt/flink/conf/flink-conf.yaml to hdfs://localhost:9000/user/root/.flink/application_1588744655039_0008/flink-conf.yaml

15:00:10,193 INFO? org.apache.flink.yarn.Utils? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Copying from file:/opt/flink/conf/logback.xml to hdfs://localhost:9000/user/root/.flink/application_1588744655039_0008/logback.xml

15:00:10,219 INFO? org.apache.flink.yarn.Utils? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Copying from file:/opt/flink/conf/log4j.properties to hdfs://localhost:9000/user/root/.flink/application_1588744655039_0008/log4j.properties

15:00:10,249 INFO? org.apache.flink.yarn.Client? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Submitting application master application_1588744655039_0008

15:00:10,282 INFO? org.apache.hadoop.yarn.client.api.impl.YarnClientImpl? ? ? ? - Submitted application application_1588744655039_0008

Flink JobManager is now running on centos1:6131

JobManager Web Interface: http://centos1:8088/proxy/application_1588744655039_0008/

Number of connected TaskManagers changed to 1. Slots available: 1

提交任務(wù)

hadoop fs -mkdir /input

hadoop fs -mkdir /output

hadoop fs -put /opt/flink/NOTICE /input

flink run -c org.apache.flink.examples.java.wordcount.WordCount? /opt/flink/examples/flink-java-examples-0.8.0-WordCount.jar hdfs:///input/NOTICE hdfs:///output/20200506eFound a yarn properties file (.yarn-properties) file, using "centos1:6131" to connect to the JobManager

05/06/2020 15:37:29: Job execution switched to status RUNNING

05/06/2020 15:37:29: CHAIN DataSource (at getTextDataSet(WordCount.java:141) (org.apache.flink.api.java.io.TextInputFormat)) -> FlatMap (FlatMap at main(WordCount.java:69)) -> Combine(SUM(1), at main(WordCount.java:72) (1/1) switched to SCHEDULED

05/06/2020 15:37:29: CHAIN DataSource (at getTextDataSet(WordCount.java:141) (org.apache.flink.api.java.io.TextInputFormat)) -> FlatMap (FlatMap at main(WordCount.java:69)) -> Combine(SUM(1), at main(WordCount.java:72) (1/1) switched to DEPLOYING

05/06/2020 15:37:29: CHAIN DataSource (at getTextDataSet(WordCount.java:141) (org.apache.flink.api.java.io.TextInputFormat)) -> FlatMap (FlatMap at main(WordCount.java:69)) -> Combine(SUM(1), at main(WordCount.java:72) (1/1) switched to RUNNING

05/06/2020 15:37:29: Reduce (SUM(1), at main(WordCount.java:72) (1/1) switched to SCHEDULED

05/06/2020 15:37:29: Reduce (SUM(1), at main(WordCount.java:72) (1/1) switched to DEPLOYING

05/06/2020 15:37:29: Reduce (SUM(1), at main(WordCount.java:72) (1/1) switched to RUNNING

05/06/2020 15:37:29: CHAIN DataSource (at getTextDataSet(WordCount.java:141) (org.apache.flink.api.java.io.TextInputFormat)) -> FlatMap (FlatMap at main(WordCount.java:69)) -> Combine(SUM(1), at main(WordCount.java:72) (1/1) switched to FINISHED

05/06/2020 15:37:29: DataSink(CsvOutputFormat (path: hdfs:/output/20200506e, delimiter:? )) (1/1) switched to SCHEDULED

05/06/2020 15:37:29: DataSink(CsvOutputFormat (path: hdfs:/output/20200506e, delimiter:? )) (1/1) switched to DEPLOYING

05/06/2020 15:37:29: DataSink(CsvOutputFormat (path: hdfs:/output/20200506e, delimiter:? )) (1/1) switched to RUNNING

05/06/2020 15:37:29: Reduce (SUM(1), at main(WordCount.java:72) (1/1) switched to FINISHED

05/06/2020 15:37:29: DataSink(CsvOutputFormat (path: hdfs:/output/20200506e, delimiter:? )) (1/1) switched to FINISHED

05/06/2020 15:37:29: Job execution switched to status FINISHED

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子煮盼,更是在濱河造成了極大的恐慌离唬,老刑警劉巖寂嘉,帶你破解...
    沈念sama閱讀 212,718評(píng)論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件卷哩,死亡現(xiàn)場(chǎng)離奇詭異昂灵,居然都是意外死亡色鸳,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,683評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門坠七,熙熙樓的掌柜王于貴愁眉苦臉地迎上來水醋,“玉大人,你說我怎么就攤上這事彪置≈糇伲” “怎么了?”我有些...
    開封第一講書人閱讀 158,207評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵悉稠,是天一觀的道長宫蛆。 經(jīng)常有香客問我,道長的猛,這世上最難降的妖魔是什么耀盗? 我笑而不...
    開封第一講書人閱讀 56,755評(píng)論 1 284
  • 正文 為了忘掉前任,我火速辦了婚禮卦尊,結(jié)果婚禮上叛拷,老公的妹妹穿的比我還像新娘。我一直安慰自己岂却,他們只是感情好忿薇,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,862評(píng)論 6 386
  • 文/花漫 我一把揭開白布裙椭。 她就那樣靜靜地躺著,像睡著了一般署浩。 火紅的嫁衣襯著肌膚如雪揉燃。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 50,050評(píng)論 1 291
  • 那天筋栋,我揣著相機(jī)與錄音炊汤,去河邊找鬼。 笑死弊攘,一個(gè)胖子當(dāng)著我的面吹牛抢腐,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播襟交,決...
    沈念sama閱讀 39,136評(píng)論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼迈倍,長吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來了捣域?” 一聲冷哼從身側(cè)響起啼染,我...
    開封第一講書人閱讀 37,882評(píng)論 0 268
  • 序言:老撾萬榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎竟宋,沒想到半個(gè)月后提完,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,330評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡丘侠,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,651評(píng)論 2 327
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了逐样。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片蜗字。...
    茶點(diǎn)故事閱讀 38,789評(píng)論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖脂新,靈堂內(nèi)的尸體忽然破棺而出挪捕,到底是詐尸還是另有隱情,我是刑警寧澤争便,帶...
    沈念sama閱讀 34,477評(píng)論 4 333
  • 正文 年R本政府宣布级零,位于F島的核電站,受9級(jí)特大地震影響滞乙,放射性物質(zhì)發(fā)生泄漏奏纪。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,135評(píng)論 3 317
  • 文/蒙蒙 一斩启、第九天 我趴在偏房一處隱蔽的房頂上張望序调。 院中可真熱鬧,春花似錦兔簇、人聲如沸发绢。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,864評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽边酒。三九已至经柴,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間墩朦,已是汗流浹背口锭。 一陣腳步聲響...
    開封第一講書人閱讀 32,099評(píng)論 1 267
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留介杆,地道東北人鹃操。 一個(gè)月前我還...
    沈念sama閱讀 46,598評(píng)論 2 362
  • 正文 我出身青樓,卻偏偏與公主長得像春哨,于是被迫代替她去往敵國和親荆隘。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,697評(píng)論 2 351