开发环境:Mac OS(Unix)
Hadoop版本:0.21.0
Eclipse版本: 3.6.0
第一步:下载Hadoop
下载地址:http://hadoop.apache.org/common/releases.html#Download
注意,当前21版本的Hadoop是不稳定、不支持并且不保证安全的最新版本。
第二步:配置Hadoop
将下载的Hadoop压缩文件解压缩,找到conf目录,打开core-site.xml,修改代码如下所示:
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>localhost:9000</value>
- </property>
- </configuration>
找到mapred-site.xml修改代码如下所示:
Xml代码
- <?xml version="1.0"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <!-- Put site-specific property overrides in this file. -->
- <configuration>
- <property>
- <name>mapred.job.tracker</name>
- <value>localhost:9001</value>
- </property>
- </configuration>
找到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>
- </configuration>
找到hadoop-env.sh打开,加入以下配置
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
export HADOOP_INSTALL=/Users/alex/Documents/DevRes/hadoop-0.21.0
export PATH=$PATH:$HADOOP_INSTALL/bin
其中,具体的目录根据你的实际情况配置。
