官术网_书友最值得收藏!

Time for action – running WordCount on a local Hadoop cluster

Now we have generated the class files and collected them into a JAR file, we can run the application by performing the following steps:

  1. Submit the new JAR file to Hadoop for execution.
    $ hadoop jar wc1.jar WordCount1 test.txt output
    
  2. If successful, you should see the output being very similar to the one we obtained when we ran the Hadoop-provided sample WordCount in the previous chapter. Check the output file; it should be as follows:
    $ Hadoop fs –cat output/part-r-00000
    This 1
    yes 1
    a 1
    is 2
    test 1
    this 1
    

What just happened?

This is the first time we have used the Hadoop JAR command with our own code. There are four arguments:

  1. The name of the JAR file.
  2. The name of the driver class within the JAR file.
  3. The location, on HDFS, of the input file (a relative reference to the /user/Hadoop home folder, in this case).
  4. The desired location of the output folder (again, a relative path).

Tip

The name of the driver class is only required if a main class has not (as in this case) been specified within the JAR file manifest.

主站蜘蛛池模板: 东宁县| 开封市| 揭西县| 大荔县| 临沂市| 社会| 莱州市| 盐山县| 尚义县| 陕西省| 平江县| 邢台县| 抚顺县| 乌鲁木齐市| 黎川县| 安吉县| 岚皋县| 绥芬河市| 张掖市| 萨嘎县| 通化市| 抚远县| 嫩江县| 阜阳市| 浦江县| 望江县| 固阳县| 松阳县| 南和县| 阳春市| 板桥市| 五大连池市| 肇东市| 洞口县| 桐城市| 荣昌县| 林周县| 聊城市| 望江县| 西平县| 双流县|