hadoop 0.21.0 伪分布式环境筹建(mac雪豹系统)
hadoop 0.21.0 伪分布式环境搭建(mac雪豹系统)1.下载hadoop包,http://labs.renren.com/apache-mirror//had
hadoop 0.21.0 伪分布式环境搭建(mac雪豹系统)
1.下载hadoop包,http://labs.renren.com/apache-mirror//hadoop/core/hadoop-0.21.0/hadoop-0.21.0.tar.gz
2.解压 tar xzf hadoop-0.21.0.tar.gz
3.进入hadoop解压后得文件夹,编辑hadoop-env.sh 指定JAVA_HOME变量,比如
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
4.edit ~/.bash_profile
export HADOOP_INSTALL=your hadoop directoryexport HADOOP_HOME=your hadoop directoryexport PATH=$PATH:$HADOOP_INSTALL/bin
5.重新开shell窗口,执行 hadoop version,可以看到如下信息
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost</value>
</property>
</configuration>
(2)修改hdfs-site.xml
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
(3) edit mapred-site.xml
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:8021</value>
</property>
</configuration>
(4)执行
引用
start-dfs.sh
start-mapred.sh
现在可以试用hadoop的威力了,如果不会用hadoop,这里有使用python的脚本方法
[url]
http://packages.python.org/mrjob/writing-and-running.html#running-on-your-own-hadoop-cluster
[/url]
只需要执行
引用python your_mr_job_sub_class.py -r hadoop < input > output
非常方便
10 停止守护进程
引用
stop-dfs.sh
stop-mapred.sh
最后强烈推荐这本书,http://product.china-pub.com/196200&ref=browse