CDH quick start VM 中運行wordcount例子

須要注意的事情:html

1. 對於wordcount1.0 ,按照http://www.cloudera.com/content/cloudera/en/documentation/HadoopTutorial/CDH4/Hadoop-Tutorial/ht_usage.html#topic_5_2 執行。java

2.hadoop fs -mkdir /user/cloudera 這條語句意思是在hadoop文件系統下建立新文件夾。在終端中執行"cd /user/cloudera"是錯誤的,會出現找不到文件提示。個人理解是hadoop文件系統爲每個組件創建了一個文件夾,其中user是主目錄,下面對應的是各個組件文件夾。以下面代碼所示,cloudera,hdfs,hive都有本身對應的文件夾。oop

[cloudera@quickstart ~]$ hadoop fs -ls /user/cloudera
Found 1 items
drwxr-xr-x   - cloudera cloudera          0 2015-01-11 05:16 /user/cloudera/wordcount
[cloudera@quickstart ~]$ hadoop fs -ls /user/hdfs
Found 1 items
drwxr-xr-x   - hdfs supergroup          0 2015-01-10 23:45 /user/hdfs/.Trash
[cloudera@quickstart ~]$ hadoop fs -ls /user/hive
Found 1 items
drwxrwxrwx   - hive hive          0 2015-01-11 03:46 /user/hive/warehouse
[cloudera@quickstart ~]$ 

3.在進行第三部的時候「compile wordcount.java」,首先要把源代碼拷貝下來,在"/home/cloudera/"下面新建文件WordCount.java,注意區分大小寫。而後執行:ui

mkdir wordcount_classes
javac -classpath /usr/lib/hadoop/hadoop-common-2.5.0-cdh5.2.0.jar:/usr/lib/hadoop/client/hadoop-mapreduce-client-core-2.5.0-cdh5.2.0.jar -d wordcount_classes WordCount.java

注意根據本身的版本把上面的代碼替換成適合本身的。spa

4.完成上步以後,徹底按照官網(http://www.cloudera.com/content/cloudera/en/documentation/HadoopTutorial/CDH4/Hadoop-Tutorial/ht_usage.html#topic_5_2)來便可。code

 

chuanting.zhang @ 2015-01-11 引用請註明出處 http://www.cnblogs.com/chuantingSDU/。htm

相關文章
相關標籤/搜索