目錄
一、對于 sogou_500w_utf 數據,使用 MapReduce 編程模型完成對以下數據的分析任務
1. 統計 2011-12-30 日搜索記錄,每個時間段的搜索次數
(1)運行截圖
(2) 源代碼
2. 統計 2011-12-30 日 3 點至 4 點之間,哪些 UID 訪問了搜狗引擎。
(1)運行截圖
(2)源代碼
二、有兩個輸入文件 A 和 B,使用 MapReduce 編程合并文件,得到輸出文件 C
1. 輸入文件A和B如下
2. 通過MapReduce編程合并文件得到outputC
3. 源代碼
一、對于 sogou_500w_utf 數據,使用 MapReduce 編程模型完成對以下數據的分析任務
1. 統計 2011-12-30 日搜索記錄,每個時間段的搜索次數
(每小時為一個單位,比如 0 點鐘多少次,1 點鐘多少次,2 點鐘多少次,一直到 23 點多少次)
(1)運行截圖
hadoop jar /home/2130502441ryx/SearchCountJob.jar org/ryx/SearchCountJob /sogou.500.utf8 /output5
?
hdfs dfs -ls /output5hdfs dfs -cat /output5/part-r-00000
(2) 源代碼
① SearchCountMapper
② SearchCountReduct
③ SearchCountJob
2. 統計 2011-12-30 日 3 點至 4 點之間,哪些 UID 訪問了搜狗引擎。
(1)運行截圖
hadoop jar /home/2130502441ryx/UIDCountJob.jar org/ryx/SogouDriver /sogou.500.utf8 /output7
(下面截圖貼錯了,上面的運行命令才是正確的)
hdfs dfs -ls /output7hdfs dfs -cat /output7/part-r-00000
(2)源代碼
SogouMapper.java
SogouReducer.java
SogouDriver.java
二、有兩個輸入文件 A 和 B,使用 MapReduce 編程合并文件,得到輸出文件 C
輸入文件 A 的樣例如下:
20150101 x
20150102 y
20150103 x
20150104 y
20150105 z
20150106 x
輸入文件 B 的樣例如下:
20150101 y
20150102 y
20150103 x
20150104 z
20150105 y
根據輸入文件 A 和 B 合并得到的輸出文件 C 的樣例如下:
20150101 x
20150101 y
20150102 y
20150103 x
20150104 y
20150104 z
20150105 y
20150105 z
20150106 x
1. 輸入文件A和B如下
hdfs dfs -cat /inputA
hdfs dfs -cat /inputB
2. 通過MapReduce編程合并文件得到outputC
hadoop jar /home/2130502441ryx/MergeFiles.jar org/ryx/MergeFiles /inputA /inputB /outputC
hdfs dfs -cat /outputC/part-r-00000
3. 源代碼
① MergeMapper
② MergeReducer
③ MergeFiles