Hadoop 單機部署與eclipse開發

來源:互聯網
上載者:User

A)版本 

hadoop-1.0.3 

jdk1.6.0_32

eclipse hadoop開發外掛程式 hadoop-eclipse-plugin-1.0.3.jar

hadoop-1.0.3  使用單機模式安裝, 連接埠 hdfs 9000  mapred 9001

B)環境

1) hadoop-1.0.3 的安裝步驟 可以參照http://hadoop.apache.org/docs/r1.0.3/single_node_setup.html

conf/core-site.xml

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --><configuration><property>          <name>fs.default.name</name>          <value>hdfs://xxx.xxx.xxx.xxx:9000</value>  </property><property>        <name>hadoop.tmp.dir</name>        <value>/opt/hadoop-1.0.3/tmp</value> </property></configuration>

conf/mapred-site.xml:

<configuration>     <property>         <name>mapred.job.tracker</name>         <value>xxx.xxx.xxx.xxx:9001</value>     </property></configuration>

conf/hdfs-site.xml

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --><configuration>        <property>                  <name>dfs.replication</name>                  <value>1</value>          </property>          <property>                 <name>dfs.permissions</name>                 <value>false</value>         </property></configuration>

將xxx.xxx.xxx.xxx改成你的伺服器的IP

2)開發

1、用的是WINDOWS 下的 Eclipse,將外掛程式複製到plugin目錄裡就可以了

2、將hadoop-1.0.3  解壓到程式員的開發機器上

3、設定Hadoop Map/Reduce到你解壓的目錄

4、配置Map/Reduce Location 

5、

建立Map/Reduce工程 

examples\org\apache\hadoop\examples中的WordCount.java匯入到工程裡

問題出來了 直接啟動並執行話 會提示許可權問題。

12/09/24 13:52:27 ERROR security.UserGroupInformation: PriviledgedActionException as:zzj cause:java.io.IOException: Failed to set permissions of path: \tmp\hadoop-zzj\mapred\staging\zzj-743566479\.staging to 0700
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-zzj\mapred\staging\zzj-743566479\.staging to 0700

處理這個問題可以直接使用。

conf.set("mapred.job.tracker", "218.249.75.144:9001");

來手工指定

用RunAS 選擇 Run on Hadoop運行這個工程。eclipse 會自動將Jar包傳輸到Hadoop上並運行

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.