unable to run hadoop wordcount example?

前端 未结 4 1021
暗喜
暗喜 2021-01-06 07:53

I am running hadoop wordcount example in single node environment on ubuntu 12.04 in vmware. i running the example like this:--

hadoop@master:~/hadoop$ hadoop         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-06 08:02

    If you've created your own .jar and is trying to run it, pay attention:

    In order the run your job, you had to have written something like this:

    hadoop jar    
    

    But if you take a closer look to your driver code, you'll see that you have set arg[0] as your input and arg[1] as your output... I'll show it:

    FileInputFormart.addInputPath(conf, new Path(args[0]));
    FileOutFormart.setOutputPath(conf, new Path(args[1]));
    

    But, hadoop is taking arg[0] as instead of and arg[1] as instead of

    So, in order to make it work, you should use:

    FileInputFormart.addInputPath(conf, new Path(args[1]));
    FileOutFormart.setOutputPath(conf, new Path(args[2]));
    

    With arg[1] and arg[2], so it'll get the right things! :) Hope it helped. Cheers.

提交回复
热议问题