报错

hadoop中的报错

mismatch

报错如下:

INFO mapreduce.Job:Task Id:attempt_1589445736284_0017_m_000000_0, Status : FAILED
Error: java.io.IOException:Type mismatch in key from map:expected org.apache.hadoop.io.Text, received org.example.sort2.FlowBean
	at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:1074)
	at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:715)
	at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89)
	at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(WrappedMapper.java:112)
	at org.example.sort2.FlowCountSort$FlowCountSortMapper.map(FlowCountSort.java:37)
	at org.example.sort2.FlowCountSort$FlowCountSortMapper.map(FlowCountSort.java:18)
	at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:146)
	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
	at java.security.AccessControIIer.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1758)
	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

解析:想要一个Text却给了一个FlowBean,类型不匹配,输出类型不对
解决办法:修改代码中的输出类型

spark中的报错

JAVA_HOME is not set

hrbu30: failed to launch: nice -n 0 /opt/wdp/spark/bin/spark-class org.apache.spark.deploy.worker.Worker --webui-port 8081 spark://hrbu30: 7077
hrbu30 :JAVA HOME is not set
hrbu30: full log in /opt/wdp/spark/logs/spark-hadoop-org.apache.spark,deploy.worker.Worker-1-hrbu30.out
hrbu31: failed to launch: nice -n 0 /opt/wdp/spark/bin/spark-class org.apache.spark.deploy.worker.Worker --webui-port 8081 spark://hrbu30: 7077
hrbu31 :JAVA HOME is not set
hrbu31: full log in /opt/wdp/spark/logs/ spark-hadoop-org.apache.spark.deploy.worker.Worker-1-hrbu31. out
hrbu32: failed to launch: nice -n 0 /opt/wdp/ spark/bin/spark-class org.apache.spark.deploy.worker.Worker --webui-port 8081 spark:/ /hrbu30: 7077
hrbu32:JAVA HOME is not set
hrbu32: full log in /opt/wdp/spark/logs/spark-hadoop-org.apache.spark.deploy worker.Worker-1-hrbu32. out

解析:遇到 “JAVA_HOME not set” 异常
解决办法:在spark的sbin目录下的spark-config.sh 文件中加入如下配置:

export JAVA_HOME=XXXX

我的jdk在/opt/wdp/jdk下,所以应该配置为

export JAVA_HOME=/opt/wdp/jdk

UnknownHostException:mycluster

scala> sc.textFile("hdfs://mycluster/data/wc.txt").flatMap(_.split(" ")).map((_,1)).reduceByKey(_+_).collect
java.lang.IllegalArgumentException: java.net.UnknownHostException:mycluster
	at eorg.apache.hadoop.security.SecurityUtil.buildTokenService(SecurityUtil.java:378)
	at org.apache.hadoop.hdfs.NameNodeProxies.createNonHAProxy(NameNodeProxies.java:310)
	at org apache.hadoop.hdfs.NameNodeProxies.createProxy(NameNodeProxies.java:176)
	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:678)
	at org.apache.hadoop.hdfs.DFSclient.<init>(DFSClient.java:619)
	at org.apache.hadoop.hdfs.DistributedFileSystem.initialize (DistributedFileSystem.java:149)at org.apache.hadoop.fs.FileSystem.CreateFileSystem(FileSysem.java: 2669)

解析:不认识自己配置的双namenode名字(mycluster)
解决办法:将配置双namenode的ha中的core-site.xml、hdfs-site.xml复制一份到/opt/wdp/spark/conf/中
配置如下:

cd /opt/ha/hadoop/etc/hadoop
[hadoop@hrbu30 hadoop]$ cp core-site.xml /opt/wdp/spark/conf/
[hadoop@hrbu30 hadoop]$ cp hdfs-site.xml /opt/wdp/spark/conf/

Master must either be yarn or start with spark, mesos, k8s, or local

[hadoop@hrbu30 spark]$ bin/spark-submit \
> --class org.apache.spark.examples.SparkPi \
> --master yarn\
> --deploy-mode client \
> ./examples/jars/spark-examples_2.11-2.4.6.jar \
> 100

报错如下:

Exception in thread "main" org.apache.spark.SparkException: Master must either be yarn or start with spark, mesos, k8s, or local
	at org.apache.spark.deploy.SparkSubmit.error(SparkSubmit.scala:853)
	at org.apache.spark.deploy.SparkSubmit.prepareSubmitEnvironment(SparkSubmit.scala:223)
	at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:774)
	at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:161)
	at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:184)
	at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
	at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:920)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:929)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

解析:第三行–master yarn\的yarn和\之间少一个空格
解决办法:添加上空格即可

2.2 GB of 2.1 GB virtual memory used

[hadoop@hrbu30 spark]$ bin/spark-submit \
> --class org.apache.spark.examples.SparkPi \
> --master yarn \
> --deploy-mode client \
> ./examples/jars/spark-examples_2.11-2.4.6.jar \
> 100
20/06/20 07:30:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/06/20 07:30:22 INFO spark.SparkContext: Running Spark version 2.4.6
20/06/20 07:30:22 INFO spark.SparkContext: Submitted application: Spark Pi
20/06/20 07:30:22 INFO spark.SecurityManager: Changing view acls to: hadoop
20/06/20 07:30:22 INFO spark.SecurityManager: Changing modify acls to: hadoop
20/06/20 07:30:22 INFO spark.SecurityManager: Changing view acls groups to: 
20/06/20 07:30:22 INFO spark.SecurityManager: Changing modify acls groups to: 
20/06/20 07:30:22 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(hadoop); groups with view permissions: Set(); users  with modify permissions: Set(hadoop); groups with modify permissions: Set()
20/06/20 07:30:23 INFO util.Utils: Successfully started service 'sparkDriver' on port 47931.
20/06/20 07:30:23 INFO spark.SparkEnv: Registering MapOutputTracker
20/06/20 07:30:23 INFO spark.SparkEnv: Registering BlockManagerMaster
20/06/20 07:30:23 INFO storage.BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
20/06/20 07:30:23 INFO storage.BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up
20/06/20 07:30:23 INFO storage.DiskBlockManager: Created local directory at /tmp/blockmgr-eb43ff83-f5d4-4eaa-8eff-7d25116dda55
20/06/20 07:30:23 INFO memory.MemoryStore: MemoryStore started with capacity 366.3 MB
20/06/20 07:30:23 INFO spark.SparkEnv: Registering OutputCommitCoordinator
20/06/20 07:30:23 INFO util.log: Logging initialized @3332ms
20/06/20 07:30:23 INFO server.Server: jetty-9.3.z-SNAPSHOT, build timestamp: unknown, git hash: unknown
20/06/20 07:30:23 INFO server.Server: Started @3476ms
20/06/20 07:30:23 WARN util.Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041.
20/06/20 07:30:23 INFO server.AbstractConnector: Started ServerConnector@2ba5e810{HTTP/1.1,[http/1.1]}{0.0.0.0:4041}
20/06/20 07:30:23 INFO util.Utils: Successfully started service 'SparkUI' on port 4041.
20/06/20 07:30:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@1db0ec27{/jobs,null,AVAILABLE,@Spark}
20/06/20 07:30:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@50cf5a23{/jobs/json,null,AVAILABLE,@Spark}
20/06/20 07:30:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@450794b4{/jobs/job,null,AVAILABLE,@Spark}
20/06/20 07:30:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@30457e14{/jobs/job/json,null,AVAILABLE,@Spark}
20/06/20 07:30:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@1af1347d{/stages,null,AVAILABLE,@Spark}
20/06/20 07:30:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@632aa1a3{/stages/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@20765ed5{/stages/stage,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@1e8823d2{/stages/stage/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@c1a4620{/stages/pool,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@76b0ae1b{/stages/pool/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@130a0f66{/storage,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@4c432866{/storage/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@12365c88{/storage/rdd,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@6105f8a3{/storage/rdd/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@2237bada{/environment,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@77e2a6e2{/environment/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@5710768a{/executors,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@199e4c2b{/executors/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@6e0d4a8{/executors/threadDump,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@64d7b720{/executors/threadDump/json,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@30272916{/static,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@74518890{/,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@4c5204af{/api,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@30865a90{/jobs/job/kill,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@6134ac4a{/stages/stage/kill,null,AVAILABLE,@Spark}
20/06/20 07:30:24 INFO ui.SparkUI: Bound SparkUI to 0.0.0.0, and started at http://hrbu30:4041
20/06/20 07:30:24 INFO spark.SparkContext: Added JAR file:/opt/wdp/spark/./examples/jars/spark-examples_2.11-2.4.6.jar at spark://hrbu30:47931/jars/spark-examples_2.11-2.4.6.jar with timestamp 1592609424167
20/06/20 07:30:41 INFO client.ConfiguredRMFailoverProxyProvider: Failing over to rm2
20/06/20 07:30:41 INFO yarn.Client: Requesting a new application from cluster with 3 NodeManagers
20/06/20 07:30:41 INFO yarn.Client: Verifying our application has not requested more than the maximum memory capability of the cluster (8192 MB per container)
20/06/20 07:30:41 INFO yarn.Client: Will allocate AM container, with 896 MB memory including 384 MB overhead
20/06/20 07:30:41 INFO yarn.Client: Setting up container launch context for our AM
20/06/20 07:30:41 INFO yarn.Client: Setting up the launch environment for our AM container
20/06/20 07:30:41 INFO yarn.Client: Preparing resources for our AM container
20/06/20 07:30:41 WARN yarn.Client: Neither spark.yarn.jars nor spark.yarn.archive is set, falling back to uploading libraries under SPARK_HOME.
20/06/20 07:30:44 INFO yarn.Client: Uploading resource file:/tmp/spark-52b70399-9b17-4eba-b7c8-516af721bab2/__spark_libs__7835543021843581423.zip -> hdfs://mycluster/user/hadoop/.sparkStaging/application_1592460818872_0003/__spark_libs__7835543021843581423.zip
20/06/20 07:30:50 INFO yarn.Client: Uploading resource file:/tmp/spark-52b70399-9b17-4eba-b7c8-516af721bab2/__spark_conf__8681154760836187739.zip -> hdfs://mycluster/user/hadoop/.sparkStaging/application_1592460818872_0003/__spark_conf__.zip
20/06/20 07:30:50 INFO spark.SecurityManager: Changing view acls to: hadoop
20/06/20 07:30:50 INFO spark.SecurityManager: Changing modify acls to: hadoop
20/06/20 07:30:50 INFO spark.SecurityManager: Changing view acls groups to: 
20/06/20 07:30:50 INFO spark.SecurityManager: Changing modify acls groups to: 
20/06/20 07:30:50 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(hadoop); groups with view permissions: Set(); users  with modify permissions: Set(hadoop); groups with modify permissions: Set()
20/06/20 07:30:51 INFO yarn.Client: Submitting application application_1592460818872_0003 to ResourceManager
20/06/20 07:30:52 INFO impl.YarnClientImpl: Submitted application application_1592460818872_0003
20/06/20 07:30:52 INFO cluster.SchedulerExtensionServices: Starting Yarn extension services with app application_1592460818872_0003 and attemptId None
20/06/20 07:30:53 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:30:53 INFO yarn.Client: 
	 client token: N/A
	 diagnostics: N/A
	 ApplicationMaster host: N/A
	 ApplicationMaster RPC port: -1
	 queue: default
	 start time: 1592609546684
	 final status: UNDEFINED
	 tracking URL: http://hrbu31:8088/proxy/application_1592460818872_0003/
	 user: hadoop
20/06/20 07:30:54 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:30:55 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:30:56 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:30:57 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:30:58 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:30:59 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:00 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:01 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:02 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:03 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:04 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:05 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:06 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:07 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:08 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:09 INFO yarn.Client: Application report for application_1592460818872_0003 (state: ACCEPTED)
20/06/20 07:31:10 INFO yarn.Client: Application report for application_1592460818872_0003 (state: FAILED)
20/06/20 07:31:10 INFO yarn.Client: 
	 client token: N/A
	 diagnostics: Application application_1592460818872_0003 failed 2 times due to AM Container for appattempt_1592460818872_0003_000002 exited with  exitCode: -103
For more detailed output, check application tracking page:http://hrbu31:8088/cluster/app/application_1592460818872_0003Then, click on links to logs of each attempt.
Diagnostics: Container [pid=64506,containerID=container_e13_1592460818872_0003_02_000001] is running beyond virtual memory limits. Current usage: 71.6 MB of 1 GB physical memory used; 2.2 GB of 2.1 GB virtual memory used. Killing container.
Dump of the process-tree for container_e13_1592460818872_0003_02_000001 :
	|- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
	|- 64510 64506 64506 64506 (java) 167 80 2268135424 18008 /opt/wdp/jdk//bin/java -server -Xmx512m -Djava.io.tmpdir=/opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/tmp -Dspark.yarn.app.container.log.dir=/opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001 org.apache.spark.deploy.yarn.ExecutorLauncher --arg hrbu30:47931 --properties-file /opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/__spark_conf__/__spark_conf__.properties 
	|- 64506 64504 64506 64506 (bash) 0 0 108609536 333 /bin/bash -c /opt/wdp/jdk//bin/java -server -Xmx512m -Djava.io.tmpdir=/opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/tmp -Dspark.yarn.app.container.log.dir=/opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001 org.apache.spark.deploy.yarn.ExecutorLauncher --arg 'hrbu30:47931' --properties-file /opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/__spark_conf__/__spark_conf__.properties 1> /opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/stdout 2> /opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/stderr 

Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143
Failing this attempt. Failing the application.
	 ApplicationMaster host: N/A
	 ApplicationMaster RPC port: -1
	 queue: default
	 start time: 1592609546684
	 final status: FAILED
	 tracking URL: http://hrbu31:8088/cluster/app/application_1592460818872_0003
	 user: hadoop
20/06/20 07:31:10 INFO yarn.Client: Deleted staging directory hdfs://mycluster/user/hadoop/.sparkStaging/application_1592460818872_0003
20/06/20 07:31:10 ERROR cluster.YarnClientSchedulerBackend: The YARN application has already ended! It might have been killed or the Application Master may have failed to start. Check the YARN application logs for more details.
20/06/20 07:31:10 ERROR spark.SparkContext: Error initializing SparkContext.
org.apache.spark.SparkException: Application application_1592460818872_0003 failed 2 times due to AM Container for appattempt_1592460818872_0003_000002 exited with  exitCode: -103
For more detailed output, check application tracking page:http://hrbu31:8088/cluster/app/application_1592460818872_0003Then, click on links to logs of each attempt.
Diagnostics: Container [pid=64506,containerID=container_e13_1592460818872_0003_02_000001] is running beyond virtual memory limits. Current usage: 71.6 MB of 1 GB physical memory used; 2.2 GB of 2.1 GB virtual memory used. Killing container.
Dump of the process-tree for container_e13_1592460818872_0003_02_000001 :
	|- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
	|- 64510 64506 64506 64506 (java) 167 80 2268135424 18008 /opt/wdp/jdk//bin/java -server -Xmx512m -Djava.io.tmpdir=/opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/tmp -Dspark.yarn.app.container.log.dir=/opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001 org.apache.spark.deploy.yarn.ExecutorLauncher --arg hrbu30:47931 --properties-file /opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/__spark_conf__/__spark_conf__.properties 
	|- 64506 64504 64506 64506 (bash) 0 0 108609536 333 /bin/bash -c /opt/wdp/jdk//bin/java -server -Xmx512m -Djava.io.tmpdir=/opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/tmp -Dspark.yarn.app.container.log.dir=/opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001 org.apache.spark.deploy.yarn.ExecutorLauncher --arg 'hrbu30:47931' --properties-file /opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/__spark_conf__/__spark_conf__.properties 1> /opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/stdout 2> /opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/stderr 

Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143
Failing this attempt. Failing the application.
	at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:94)
	at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:63)
	at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:188)
	at org.apache.spark.SparkContext.<init>(SparkContext.scala:501)
	at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2520)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:930)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:921)
	at scala.Option.getOrElse(Option.scala:121)
	at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:921)
	at org.apache.spark.examples.SparkPi$.main(SparkPi.scala:31)
	at org.apache.spark.examples.SparkPi.main(SparkPi.scala)
	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.JavaMainApplication.start(SparkApplication.scala:52)
	at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:845)
	at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:161)
	at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:184)
	at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
	at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:920)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:929)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
20/06/20 07:31:10 INFO server.AbstractConnector: Stopped Spark@2ba5e810{HTTP/1.1,[http/1.1]}{0.0.0.0:4041}
20/06/20 07:31:10 INFO ui.SparkUI: Stopped Spark web UI at http://hrbu30:4041
20/06/20 07:31:10 WARN cluster.YarnSchedulerBackend$YarnSchedulerEndpoint: Attempted to request executors before the AM has registered!
20/06/20 07:31:10 INFO cluster.YarnClientSchedulerBackend: Shutting down all executors
20/06/20 07:31:10 INFO cluster.YarnSchedulerBackend$YarnDriverEndpoint: Asking each executor to shut down
20/06/20 07:31:10 INFO cluster.SchedulerExtensionServices: Stopping SchedulerExtensionServices
(serviceOption=None,
 services=List(),
 started=false)
20/06/20 07:31:10 INFO cluster.YarnClientSchedulerBackend: Stopped
20/06/20 07:31:10 INFO spark.MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
20/06/20 07:31:10 INFO memory.MemoryStore: MemoryStore cleared
20/06/20 07:31:10 INFO storage.BlockManager: BlockManager stopped
20/06/20 07:31:10 INFO storage.BlockManagerMaster: BlockManagerMaster stopped
20/06/20 07:31:10 WARN metrics.MetricsSystem: Stopping a MetricsSystem that is not running
20/06/20 07:31:10 INFO scheduler.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
20/06/20 07:31:10 INFO spark.SparkContext: Successfully stopped SparkContext
Exception in thread "main" org.apache.spark.SparkException: Application application_1592460818872_0003 failed 2 times due to AM Container for appattempt_1592460818872_0003_000002 exited with  exitCode: -103
For more detailed output, check application tracking page:http://hrbu31:8088/cluster/app/application_1592460818872_0003Then, click on links to logs of each attempt.
Diagnostics: Container [pid=64506,containerID=container_e13_1592460818872_0003_02_000001] is running beyond virtual memory limits. Current usage: 71.6 MB of 1 GB physical memory used; 2.2 GB of 2.1 GB virtual memory used. Killing container.
Dump of the process-tree for container_e13_1592460818872_0003_02_000001 :
	|- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
	|- 64510 64506 64506 64506 (java) 167 80 2268135424 18008 /opt/wdp/jdk//bin/java -server -Xmx512m -Djava.io.tmpdir=/opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/tmp -Dspark.yarn.app.container.log.dir=/opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001 org.apache.spark.deploy.yarn.ExecutorLauncher --arg hrbu30:47931 --properties-file /opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/__spark_conf__/__spark_conf__.properties 
	|- 64506 64504 64506 64506 (bash) 0 0 108609536 333 /bin/bash -c /opt/wdp/jdk//bin/java -server -Xmx512m -Djava.io.tmpdir=/opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/tmp -Dspark.yarn.app.container.log.dir=/opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001 org.apache.spark.deploy.yarn.ExecutorLauncher --arg 'hrbu30:47931' --properties-file /opt/ha/hadoop/data/tmp/nm-local-dir/usercache/hadoop/appcache/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/__spark_conf__/__spark_conf__.properties 1> /opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/stdout 2> /opt/ha/hadoop/logs/userlogs/application_1592460818872_0003/container_e13_1592460818872_0003_02_000001/stderr 

Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143
Failing this attempt. Failing the application.
	at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:94)
	at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:63)
	at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:188)
	at org.apache.spark.SparkContext.<init>(SparkContext.scala:501)
	at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2520)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:930)
	at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:921)
	at scala.Option.getOrElse(Option.scala:121)
	at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:921)
	at org.apache.spark.examples.SparkPi$.main(SparkPi.scala:31)
	at org.apache.spark.examples.SparkPi.main(SparkPi.scala)
	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.JavaMainApplication.start(SparkApplication.scala:52)
	at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:845)
	at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:161)
	at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:184)
	at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
	at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:920)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:929)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
20/06/20 07:31:10 INFO util.ShutdownHookManager: Shutdown hook called
20/06/20 07:31:10 INFO util.ShutdownHookManager: Deleting directory /tmp/spark-52b70399-9b17-4eba-b7c8-516af721bab2
20/06/20 07:31:10 INFO util.ShutdownHookManager: Deleting directory /tmp/spark-71dff535-325e-4d42-8272-e95cab4730ae

解析:不是内存不够的问题,是yarn的检查机制没关,(修改过hadoop配置文件yarn-site.xml,添加内容后未重新启动yarn)
解决办法:
1)如果没有修改过hadoop配置文件yarn-site.xml:
(1)修改hadoop配置文件yarn-site.xml,添加如下内容:

[hadoop@hrbu30 hadoop]$ vi yarn-site.xml

添加

        <!--是否启动一个线程检查每个任务正使用的物理内存量,如果任务超出分配值,则直接将其杀掉,默认是true -->
        <property>
                <name>yarn.nodemanager.pmem-check-enabled</name>
                <value>false</value>
        </property>
        <!--是否启动一个线程检查每个任务正使用的虚拟内存量,如果任务超出分配值,则直接将其杀掉,默认是true -->
        <property>
                <name>yarn.nodemanager.vmem-check-enabled</name>
                <value>false</value>
        </property>

2)如果修改过hadoop配置文件yarn-site.xml:
(1)重启yarn,代码如下:

[hadoop@hrbu30 hadoop]$ stop-yarn.sh

[hadoop@hrbu30 hadoop]$ start-yarn.sh
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值