ubuntu 14.04 / hadoop 2.4.0安裝問題整理

摘要:ubuntu 14.04 / hadoop 2.4.0安裝問題整理

 
教學問太多,只整理卡關的地方
 
在 ~/.bashrc 下設定hadoop環境變數完後,用hadoop -version確認是否安裝成功,卻一直失敗,反覆確認PATH都正確
每次開shell(command windows)時,只會載入一次~/.bashrc,所以要確認是否安裝成功,需要另開terminal
環境變數有三個地方可以設定,其中~/.bashrc是目前登入user的設定,不影響其他user,所以是~/開頭
安裝設定完xml,就可以用「sbin/start-dfs.sh」開啟service了,name node預設是http://localhost:50070/,這都簡單,問題是要怎麼share給別人
​ubunt​u下的ipconfig是[ nm-tool ]
virtual box的網路卡要設成「bridge mode-橋接介面卡」,設完vm要重開機,這樣host就可以用http://10.1.6.49:50070連vm裡的server了
試丟檔案給hadoop,try一下MapReduce,初看command有些不懂,做完就懂了簡單,, command如下
#在hdfs檔案系統中,建資料夾,等會兒資料會丟進來
 
#ps:hdfs檔案系統在視窗模式下看不到
hdfs dfs -mkdir /tmp
hdfs dfs -mkdir /tmp/input
#將本機檔案系統中的檔案丟入hdfs檔案系統
hdfs dfs -put file01 /tmp/input
hdfs dfs -put file02 /tmp/input
#確認hdfs檔案系統中是否有剛剛丟入的檔案
hdfs dfs -ls /tmp/input 
#試一下MapReduce
hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.4.0.jar grep /tmp/input /tmp/output 'dfs[a-z.]+'
#然後到網站上下載結果(因為懶得下command)
 

http://www.plurk.com/SophieQ