gpt4 book ai didi

hadoop - 多节点 Hadoop 从节点无法访问主节点上的 jar 文件

转载 作者:可可西里 更新时间:2023-11-01 14:44:51 26 4
gpt4 key购买 nike

我正在使用流调用 jar 文件来执行一些任务,如:

hadoop jar/path/to/hadoop-streaming.jar -input/inDir -ouput/outDir -file jarscript.sh -mapper jarscript.sh

jarscript.sh 在哪里:

java -jar/path/to/jar/X.jar -arguments

当我运行 streaming 命令时,它在主节点上运行良好,除了我在从属节点上遇到错误,它们无法访问 X.jar。我该如何改变它?如何启用对从属节点上的 jar 文件的访问?为了让从属节点访问 jar 文件,它们需要位于特定位置吗?

我用的是 Michael Noll 的教程,所以 hadoop 在 hduser 上,jar 文件在另一个用户的空间 - hadoopmaster,所以那个路径更像 /home/hadoopmaster/path/to/jar/X.jar。这可能是个问题吗?

所以,我尝试了 Donald 的方法,但奴隶仍然给我这个错误:

stderr logs

Unable to access jarfile /home/hadoopmaster/Downloads/PaDEL-Descriptor/PaDEL-Descriptor.jar
java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 1
at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:362)
at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:576)
at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:430)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:366)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
at org.apache.hadoop.mapred.Child.main(Child.java:249)



syslog logs

2013-12-09 11:18:13,183 INFO org.apache.hadoop.util.NativeCodeLoader: Loaded the native-hadoop library
2013-12-09 11:18:13,338 INFO org.apache.hadoop.filecache.TrackerDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/jars/META-INF <- /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/META-INF
2013-12-09 11:18:13,351 INFO org.apache.hadoop.filecache.TrackerDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/jars/jarscript.sh <- /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/jarscript.sh
2013-12-09 11:18:13,359 INFO org.apache.hadoop.filecache.TrackerDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/jars/org <- /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/org
2013-12-09 11:18:13,371 INFO org.apache.hadoop.filecache.TrackerDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/jars/lib <- /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/lib
2013-12-09 11:18:13,386 INFO org.apache.hadoop.filecache.TrackerDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/jars/.job.jar.crc <- /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/.job.jar.crc
2013-12-09 11:18:13,387 INFO org.apache.hadoop.filecache.TrackerDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/jars/job.jar <- /app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/job.jar
2013-12-09 11:18:13,598 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2013-12-09 11:18:13,691 INFO org.apache.hadoop.util.ProcessTree: setsid exited with exit code 0
2013-12-09 11:18:13,695 INFO org.apache.hadoop.mapred.Task: Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@31598bd
2013-12-09 11:18:13,770 INFO org.apache.hadoop.mapred.MapTask: Processing split: hdfs://hadoopmaster:54310/BiolData/input/biolink1/compound_id_464726_2d_3D.sdf:0+13142
2013-12-09 11:18:13,785 WARN org.apache.hadoop.io.compress.snappy.LoadSnappy: Snappy native library not loaded
2013-12-09 11:18:13,792 INFO org.apache.hadoop.mapred.MapTask: numReduceTasks: 1
2013-12-09 11:18:13,800 INFO org.apache.hadoop.mapred.MapTask: io.sort.mb = 100
2013-12-09 11:18:13,840 INFO org.apache.hadoop.mapred.MapTask: data buffer = 79691776/99614720
2013-12-09 11:18:13,840 INFO org.apache.hadoop.mapred.MapTask: record buffer = 262144/327680
2013-12-09 11:18:13,854 INFO org.apache.hadoop.streaming.PipeMapRed: PipeMapRed exec [/app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201312091116_0001/attempt_201312091116_0001_m_000000_1/work/./jarscript.sh]
2013-12-09 11:18:13,873 INFO org.apache.hadoop.streaming.PipeMapRed: MRErrorThread done
2013-12-09 11:18:13,877 INFO org.apache.hadoop.streaming.PipeMapRed: R/W/S=1/0/0 in:NA [rec/s] out:NA [rec/s]
2013-12-09 11:18:13,878 INFO org.apache.hadoop.streaming.PipeMapRed: R/W/S=10/0/0 in:NA [rec/s] out:NA [rec/s]
2013-12-09 11:18:13,879 INFO org.apache.hadoop.streaming.PipeMapRed: R/W/S=100/0/0 in:NA [rec/s] out:NA [rec/s]
2013-12-09 11:18:13,883 WARN org.apache.hadoop.streaming.PipeMapRed: java.io.IOException: Stream closed
at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:434)
at java.io.OutputStream.write(OutputStream.java:116)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.DataOutputStream.flush(DataOutputStream.java:123)
at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:569)
at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:430)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:366)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
at org.apache.hadoop.mapred.Child.main(Child.java:249)

2013-12-09 11:18:13,883 INFO org.apache.hadoop.streaming.PipeMapRed: PipeMapRed failed!
2013-12-09 11:18:13,913 INFO org.apache.hadoop.mapred.TaskLogsTruncater: Initializing logs' truncater with mapRetainSize=-1 and reduceRetainSize=-1
2013-12-09 11:18:13,947 INFO org.apache.hadoop.io.nativeio.NativeIO: Initialized cache for UID to User mapping with a cache timeout of 14400 seconds.
2013-12-09 11:18:13,947 INFO org.apache.hadoop.io.nativeio.NativeIO: Got UserName hduser for UID 1001 from the native implementation
2013-12-09 11:18:13,950 WARN org.apache.hadoop.mapred.Child: Error running child
java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 1
at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:362)
at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:576)
at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:430)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:366)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
at org.apache.hadoop.mapred.Child.main(Child.java:249)
2013-12-09 11:18:13,953 INFO org.apache.hadoop.mapred.Task: Runnning cleanup for the task

最佳答案

问题是您的 X.jar 可能还没有在每个节点上……对吗?因此,您需要在作业运行时将其运送到任何地方。

您可以将X.jar 添加到-file 参数中,如下所示:

hadoop jar /path/to/hadoop-streaming.jar
-input /inDir -ouput /outDir
-file jarscript.sh
-file /path/to/jar/X.jar
-mapper jarscript.sh

这会在您运行作业时将该 jar 文件发送到每个节点(就像它发送您的 jarscript.sh 的方式一样)。

请注意,您不应再在 shell 脚本中使用绝对路径。 X.jar 将位于 shell 脚本的当前工作目录中,因此您应该将脚本更改为 java -jar X.jar -arguments

关于hadoop - 多节点 Hadoop 从节点无法访问主节点上的 jar 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20477839/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com