分享

Hadoop 单机部署与eclipse开发

 funson 2013-01-06

Hadoop 单机部署与eclipse开发

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./docs/r1.0.3/single_node_setup.html

conf/core-site.xml

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!-- Put site-specific property overrides in this file. -->
  4. <configuration>
  5. <property>
  6. <name>fs.default.name</name>
  7. <value>hdfs://xxx.xxx.xxx.xxx:9000</value>
  8. </property>
  9. <property>
  10. <name>hadoop.tmp.dir</name>
  11. <value>/opt/hadoop-1.0.3/tmp</value>
  12. </property>
  13. </configuration>


conf/mapred-site.xml:

  1. <configuration>
  2. <property>
  3. <name>mapred.job.tracker</name>
  4. <value><span style='line-height: 15px; font-family: "Courier New", Courier, monospace; font-size: 14px;'>xxx.xxx.xxx.xxx</span>:9001</value>
  5. </property>
  6. </configuration>

conf/hdfs-site.xml

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!-- Put site-specific property overrides in this file. -->
  4. <configuration>
  5. <property>
  6. <name>dfs.replication</name>
  7. <value>1</value>
  8. </property>
  9. <property>
  10. <name>dfs.permissions</name>
  11. <value>false</value>
  12. </property>
  13. </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

处理这个问题可以直接使用。

  1. conf.set("mapred.job.tracker", "218.249.75.144:9001");
来手工指定


用RunAS 选择 Run on Hadoop运行这个工程。eclipse 会自动将Jar包传输到Hadoop上并运行

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多