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
<?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 处理这个问题可以直接使用。
conf.set("mapred.job.tracker", "218.249.75.144:9001");来手工指定 用RunAS 选择 Run on Hadoop运行这个工程。eclipse 会自动将Jar包传输到Hadoop上并运行 |
|