在centos6.,执行 hadoop jar word_count_class/wordcount.jar WordCount input_wordcount output_wordcount报错误了

痞子丶木易 发布于 2018/01/23 17:44
阅读 216
收藏 0

Erro is below :

18/01/23 17:04:46 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
18/01/23 17:04:46 INFO input.FileInputFormat: Total input paths to process : 2
18/01/23 17:04:46 INFO util.NativeCodeLoader: Loaded the native-hadoop library
18/01/23 17:04:46 WARN snappy.LoadSnappy: Snappy native library not loaded
18/01/23 17:04:46 INFO mapred.JobClient: Running job: job_201801222023_0005
18/01/23 17:04:47 INFO mapred.JobClient:  map 0% reduce 0%
18/01/23 17:05:00 INFO mapred.JobClient: Task Id : attempt_201801222023_0005_m_000000_0, Status : FAILED
java.lang.Throwable: Child Error
        at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:271)
Caused by: java.io.IOException: Task process exit with nonzero status of 1.
        at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:258)

attempt_201801222023_0005_m_000000_0: #
attempt_201801222023_0005_m_000000_0: # There is insufficient memory for the Java Runtime Environment to continue.
attempt_201801222023_0005_m_000000_0: # Native memory allocation (mmap) failed to map 99618816 bytes for committing reserved memory.
attempt_201801222023_0005_m_000000_0: # An error report file with more information is saved as:
attempt_201801222023_0005_m_000000_0: # /hadoop/mapred/local/taskTracker/root/jobcache/job_201801222023_0005/attempt_201801222023_0005_m_000000_0/work/hs_err_pid19949.log
attempt_201801222023_0005_m_000000_0: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000f8550000, 99618816, 0) failed; error='Cannot allocate memory' (errno=12)

My Wordcount program is 

import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;

public class WordCount {
    public static class WordCountMap extends
            Mapper<LongWritable, Text, Text, IntWritable> {
        private final IntWritable one = new IntWritable(1);
        private Text word = new Text();

        public void map(LongWritable key, Text value, Context context)
                throws IOException, InterruptedException {
            String line = value.toString();
            StringTokenizer token = new StringTokenizer(line);
            while (token.hasMoreTokens()) {
                word.set(token.nextToken());
                context.write(word, one);
            }
        }
    }

    public static class WordCountReduce extends
            Reducer<Text, IntWritable, Text, IntWritable> {
        public void reduce(Text key, Iterable<IntWritable> values,
                Context context) throws IOException, InterruptedException {
            int sum = 0;
            for (IntWritable val : values) {
                sum += val.get();
            }
            context.write(key, new IntWritable(sum));
        }
    }

    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        Job job = new Job(conf);
        job.setJarByClass(WordCount.class);
        job.setJobName("wordcount");
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(IntWritable.class);
        job.setMapperClass(WordCountMap.class);
        job.setReducerClass(WordCountReduce.class);
        job.setInputFormatClass(TextInputFormat.class);
        job.setOutputFormatClass(TextOutputFormat.class);
        FileInputFormat.addInputPath(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));
        job.waitForCompletion(true);
    }
}
 

加载中
0
r
riseee

建议贴出详细的错误日志,这个目录下面的/hadoop/mapred/local/taskTracker/root/jobcache/job_201801222023_0005/attempt_201801222023_0005_m_000000_0/work/hs_err_pid19949.log," error='Cannot allocate memory' (errno=12)" ,根据错误提示,好像是内存空间不足,

痞子丶木易
只能增加电脑内存了??
返回顶部
顶部