搭建hadoop开发环境--基于xp+cygwin
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
1.安裝cygwin
?參考博文:http://hi.baidu.com/%BD%AB%D6%AE%B7%E7_%BE%B2%D6%AE%D4%A8/blog/item/8832551c7598551f314e15c2.html??
?? ??? Q1.實際安裝中在第9步 “打開cygwin進行配置,首先輸入:ssh-host-config.回車。會讓你輸入yes/no輸入no。回車。見到Have fun!就說明成功了”有些不同
Administrator@03ad6b3ba2f34fe ~ $ ssh-host-config*** Info: Generating /etc/ssh_host_key *** Info: Generating /etc/ssh_host_rsa_key *** Info: Generating /etc/ssh_host_dsa_key *** Info: Generating /etc/ssh_host_ecdsa_key *** Info: Creating default /etc/ssh_config file *** Info: Creating default /etc/sshd_config file *** Info: Privilege separation is set to yes by default since OpenSSH 3.3. *** Info: However, this requires a non-privileged account called 'sshd'. *** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep. *** Query: Should privilege separation be used? (yes/no) no *** Info: Updating /etc/sshd_config file *** Info: Added ssh to C:\WINDOWS\system32\driversc\services*** Query: Do you want to install sshd as a service? *** Query: (Say "no" if it is already installed as a service) (yes/no) yes *** Query: Enter the value of CYGWIN for the daemon: [] --直接敲回車*** Info: The sshd service has been installed under the LocalSystem *** Info: account (also known as SYSTEM). To start the service now, call *** Info: `net start sshd' or `cygrunsrv -S sshd'. Otherwise, it *** Info: will start automatically after the next reboot.*** Info: Host configuration finished. Have fun!????? Q2. 第一次安裝中電腦死機,當時執(zhí)行到創(chuàng)建圖標的步驟,已經(jīng)可以運行了,但是還是想重裝一遍。于是找卸載辦法,有人說用setup那個文件,把選中的都uninstall一下,我信了然后就悲劇了,卸不干凈。然后找完美卸載的辦法,嘗試了一個"刪除所有cygwin的文件夾,然后清理注冊表中有cygwin的項" 這次OK了。千萬別用setup去卸載!!
2.安裝jdk和eclipse,這部分沒有遇到問題,畢業(yè)java程序也寫了1年多了
3.hadoop配置
????? 參考博文:http://hi.baidu.com/%BD%AB%D6%AE%B7%E7_%BE%B2%D6%AE%D4%A8/blog/item/a0ebb1db953a772033fa1c9a.html
?????? Q1.順著博主的第四步./hadoop jar ./../hadoop-0.20.2-examples.jar wordcount testin testout的時候開始報錯
INFO input.FileInputFormat: Total input paths to process : 2 INFO mapred.JobClient: Running job: job_201202131412_0007 INFO mapred.JobClient: map 0% reduce 0% INFO mapred.JobClient: Task Id : attempt_201202131412_0007_m_0 00003_0, Status : FAILED java.io.FileNotFoundException: File D:/hadoop/temp/taskTracker/jobcache/job_2012 02131412_0007/attempt_201202131412_0007_m_000003_0/work/tmp does not exist.at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSys tem.java:361)at 沒錯,博文下留言的人就是俺。這個錯誤怎么看都是找不到文件,上網(wǎng)找到了一個解決辦法,就是在mapred-site.xml文件中修改
后來的操作就一直O(jiān)K了。
4.常用的命令
ssh localhost? 登錄
cd /cygdriver/d/hadoop-0.20.2 進入目錄
ls? 查看當前目錄下的所有文件
在/cygdrive/d/hadoop-0.20.2/bin目錄下
./start-all.sh??? 啟動
./hadoop namenode -format 格式化一個新的HDFS
./start-all.sh? 同時啟動HDFS和MAP/Reduce
./hadoop dfs -mkdir testin 創(chuàng)建目錄testin
./hadoop dfs -put /test/*.jav0a testin 把test目錄下的java文件全部復(fù)制到testin中
./hadoop dfs -ls testin 查看testin中的所有文件
./hadoop dfs -rmr testout? 刪除testout文件夾
./hadoop jar ./../hadoop-0.20.2-examples.jar wordcount testin testout
./hadoop dfs -cat testout/part-r-00000 查看testout文件夾下的part-r-00000文件
================================
遺留的問題
1. 好多人的博客中都寫到hadoop0.20.2版本會遇到很多問題,“在windows用cygwin配置hadoop環(huán)境的時候一定要選擇0.19.2的版本”。這個我暫時沒遇到,另外提供0.19.2的下載鏈接,需要的自己下載:http://archive.apache.org/dist/hadoop/core/hadoop-0.19.2/? 我也上傳到了csdn? 或者可以留個郵箱我發(fā)給你
2. 在cygwin上跑起來沒問題的wordCount,在eclipse下跑著總有問題,和最初遇到那個問題一樣,找不到文件。這個還需要進一步解決
注.參考的文檔:http://wildrain.iteye.com/blog/1164608
?
---低頭拉車,抬頭看路
?
?
轉(zhuǎn)載于:https://my.oschina.net/wangjiankui/blog/40629
總結(jié)
以上是生活随笔為你收集整理的搭建hadoop开发环境--基于xp+cygwin的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到毒蛇预示着什么周公解梦
- 下一篇: 梦到吃黄豆芽菜是什么意思