Ich versuche, einen MapReduce-Job außerhalb des Clusters auszuführen.Hadoop-Job remote ausführen
z.B. Hadoop-Cluster wird auf Linux-Computern ausgeführt. Wir haben eine Webanwendung auf einem Windows-Rechner ausgeführt. Wir möchten den Hadoop-Job über diese Remote-Webanwendung ausführen. Wir wollen das hadoop-Ausgabeverzeichnis abrufen und es als Graph darstellen.
Wir haben folgende Stück Code geschrieben:
Configuration conf = new Configuration();
Job job = new Job(conf);
conf.set("mapred.job.tracker", "192.168.56.101:54311");
conf.set("fs.default.name", "hdfs://192.168.56.101:54310");
job.setJarByClass(Analysis.class) ;
//job.setOutputKeyClass(Text.class);
//job.setOutputValueClass(IntWritable.class);
job.setMapperClass(Map.class);
job.setReducerClass(Reduce.class);
//job.set
job.setInputFormatClass(CustomFileInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(IntWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.waitForCompletion(true);
Und das ist der Fehler, den wir bekommen. Selbst wenn wir den Hadoop 1.1.2-Cluster herunterfahren, ist der Fehler immer noch derselbe.
14/03/07 00:23:37 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
14/03/07 00:23:37 ERROR security.UserGroupInformation: PriviledgedActionException as:user cause:java.io.IOException: Failed to set permissions of path: \tmp\hadoop-user\mapred\staging\user818037780\.staging to 0700
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-user\mapred\staging\user818037780\.staging to 0700
at org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:691)
at org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:664)
at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:514)
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:349)
at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:193)
at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:126)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:942)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:936)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:936)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:550)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:580)
at LineCounter.main(LineCounter.java:86)
Versuchen Sie, mapred-ste.xml & hdfs-site.xml vom Cluster im Klassenpfad Ihrer Anwendung zu verwenden. Fügen Sie diese Dateien zu Ihrem Konfigurationsobjekt hinzu, indem Sie Folgendes aufrufen: addResource (Pfad). – Venkat
siehe https://stackoverflow.com/questions/17444720/running-hadoop-in-windows-7-setting-via-cygwin-priviledgedactionexception-asp?rq=1 –
Fazit, einige Code in Hadoop erwartet nicht jemals in einer Windows-Umgebung ausgeführt werden. Sie können sicherlich einen Patch dafür schreiben, aber wenn das zu viel Arbeit ist, könnte der beste Weg sein, den Job auf einen Linux-Rechner zu schicken, bevor Sie ihn ausführen. –