您好,登錄后才能下訂單哦!
sparkdemo.jar運行在yarn上的過程是什么,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
1.將之前打包的jar包上傳
[root@sht-sgmhadoopnn-01 spark]# pwd
/root/learnproject/app/spark
[root@sht-sgmhadoopnn-01 spark]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring sparkdemo.jar...
100% 164113 KB 421 KB/sec 00:06:29 0 Errors
2.以下是錯誤
2.1 ERROR1: Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
IDEA打包的jar包,需要使用zip刪除指定文件
zip -d sparkdemo.jar META-INF/*.RSA META-INF/*.DSA META-INF/*.SF
2.2 ERROR2: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/learn/java/main/OnLineLogAnalysis2 : Unsupported major.minor version 52.0
yarn環境的jdk版本低于編譯jar包的jdk版本(需要一致或者高于;每個節點需要安裝jdk,同時修改每個節點的hadoop-env.sh文件的JAVA_HOME參數指向)
2.3 ERROR3: java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch;
17/02/15 17:30:35 ERROR yarn.ApplicationMaster: User class threw exception: java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch;
java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch;
at org.influxdb.impl.InfluxDBImpl.ping(InfluxDBImpl.java:178)
at org.influxdb.impl.InfluxDBImpl.version(InfluxDBImpl.java:201)
at com.learn.java.main.OnLineLogAnalysis2.main(OnLineLogAnalysis2.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:627)
拋錯信息為NoSuchMethodError,表示 guava可能有多版本,則低版本
[root@sht-sgmhadoopnn-01 app]# pwd
/root/learnproject/app
[root@sht-sgmhadoopnn-01 app]# ll
total 470876
-rw-r--r-- 1 root root 7509833 Jan 16 22:11 AdminLTE.zip
drwxr-xr-x 12 root root 4096 Feb 14 11:21 hadoop
-rw-r--r-- 1 root root 197782815 Dec 24 21:16 hadoop-2.7.3.tar.gz
drwxr-xr-x 7 root root 4096 Feb 7 11:16 kafka-manager-1.3.2.1
-rw-r--r-- 1 root root 59682993 Dec 26 14:44 kafka-manager-1.3.2.1.zip
drwxr-xr-x 2 root root 4096 Jan 7 16:21 kafkaoffsetmonitor
drwxr-xr-x 2 777 root 4096 Feb 14 14:48 pid
drwxrwxr-x 4 1000 1000 4096 Oct 29 01:46 sbt
-rw-r--r-- 1 root root 1049906 Dec 25 21:29 sbt-0.13.13.tgz
drwxrwxr-x 6 root root 4096 Mar 4 2016 scala
-rw-r--r-- 1 root root 28678231 Mar 4 2016 scala-2.11.8.tgz
drwxr-xr-x 13 root root 4096 Feb 15 17:01 spark
-rw-r--r-- 1 root root 187426587 Nov 12 06:54 spark-2.0.2-bin-hadoop2.7.tgz
[root@sht-sgmhadoopnn-01 app]#
[root@sht-sgmhadoopnn-01 app]# find ./ -name *guava*
[root@sht-sgmhadoopnn-01 app]# mv ./hadoop/share/hadoop/yarn/lib/guava-11.0.2.jar ./hadoop/share/hadoop/yarn/lib/guava-11.0.2.jar.bak
[root@sht-sgmhadoopnn-01 app]# cp ./spark/libs/guava-20.0.jar ./hadoop/share/hadoop/yarn/lib/
[root@sht-sgmhadoopnn-01 app]# mv ./spark/jars/guava-14.0.1.jar ./spark/jars/guava-14.0.1.jar.bak
[root@sht-sgmhadoopnn-01 app]# cp ./spark/libs/guava-20.0.jar ./spark/jars/
[root@sht-sgmhadoopnn-01 app]# mv ./hadoop/share/hadoop/common/lib/guava-11.0.2.jar ./hadoop/share/hadoop/common/lib/guava-11.0.2.jar.bak
[root@sht-sgmhadoopnn-01 app]# cp ./spark/libs/guava-20.0.jar ./hadoop/share/hadoop/common/lib/
3.后臺提交jar包運行
[root@sht-sgmhadoopnn-01 spark]#
[root@sht-sgmhadoopnn-01 spark]# nohup /root/learnproject/app/spark/bin/spark-submit \
> --name onlineLogsAnalysis \
> --master yarn \
> --deploy-mode cluster \
> --conf "spark.scheduler.mode=FAIR" \
> --conf "spark.sql.codegen=true" \
> --driver-memory 2G \
> --executor-memory 2G \
> --executor-cores 1 \
> --num-executors 3 \
> --class com.learn.java.main.OnLineLogAnalysis2 \
> /root/learnproject/app/spark/sparkdemo.jar &
[1] 22926
[root@sht-sgmhadoopnn-01 spark]# nohup: ignoring input and appending output to `nohup.out'
[root@sht-sgmhadoopnn-01 spark]#
[root@sht-sgmhadoopnn-01 spark]#
[root@sht-sgmhadoopnn-01 spark]# tail -f nohup.out
4.yarn web界面查看運行log
ApplicationMaster:打開為spark history server web界面
logs: 查看stderr 和 stdout日志 (system.out.println方法輸出到stdout日志中)
5.查看spark history web
6.查看DashBoard ,實時可視化
關于sparkdemo.jar運行在yarn上的過程是什么問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。