1.下载hadoop包,[url]http://labs.renren.com/apache-mirror//hadoop/core/hadoop-0.21.0/hadoop-0.21.0.tar.gz[/url]
2.解压 tar xzf hadoop-0.21.0.tar.gz
3.进入hadoop解压后得文件夹,编辑hadoop-env.sh 指定JAVA_HOME变量,比如
4.edit ~/.bash_profile
5.重新开shell窗口,执行 hadoop version,可以看到如下信息
[quote]
Hadoop 0.21.0
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.21 -r 985326
Compiled by tomwhite on Tue Aug 17 01:02:28 EDT 2010
From source with checksum a1aeb15b4854808d152989ba76f90fac
[/quote]
6 配置ssh,确保你的系统允许远程登录。执行以下命令,
[quote]
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
[/quote]
7 执行 ssh localhost,如果能不输入密码就可以登录就对了。
8 首次使用hadoop,需要格式化hdfs文件系统。请在hadoop的目录下新建一个logs目录,这个目录是默认用来放置log的地方。执行以下命令
[quote]
hadoop namenode -format
[/quote]
如果没有异常抛出,只有正常的log就对了
9开启守护进程进入hadoop目录的conf子目录,
(1)修改 core-site.xml
[quote]
<?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://localhost</value>
</property>
</configuration>
[/quote]
(2)修改hdfs-site.xml
[quote]
?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>
[/quote]
(3) edit mapred-site.xml
[quote]
<?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:8021</value>
</property>
</configuration>
[/quote]
(4)执行
[quote]
start-dfs.sh
start-mapred.sh
[/quote]
现在可以试用hadoop的威力了,如果不会用hadoop,这里有使用python的脚本方法
[url]
http://packages.python.org/mrjob/writing-and-running.html#running-on-your-own-hadoop-cluster
[/url]
只需要执行
[quote]python your_mr_job_sub_class.py -r hadoop < input > output[/quote]
非常方便
10 停止守护进程
[quote]
stop-dfs.sh
stop-mapred.sh
[/quote]
最后强烈推荐这本书,[url]http://product.china-pub.com/196200&ref=browse[/url]
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 directory
export HADOOP_HOME=your hadoop directory
export PATH=$PATH:$HADOOP_INSTALL/bin
5.重新开shell窗口,执行 hadoop version,可以看到如下信息
[quote]
Hadoop 0.21.0
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.21 -r 985326
Compiled by tomwhite on Tue Aug 17 01:02:28 EDT 2010
From source with checksum a1aeb15b4854808d152989ba76f90fac
[/quote]
6 配置ssh,确保你的系统允许远程登录。执行以下命令,
[quote]
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
[/quote]
7 执行 ssh localhost,如果能不输入密码就可以登录就对了。
8 首次使用hadoop,需要格式化hdfs文件系统。请在hadoop的目录下新建一个logs目录,这个目录是默认用来放置log的地方。执行以下命令
[quote]
hadoop namenode -format
[/quote]
如果没有异常抛出,只有正常的log就对了
9开启守护进程进入hadoop目录的conf子目录,
(1)修改 core-site.xml
[quote]
<?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://localhost</value>
</property>
</configuration>
[/quote]
(2)修改hdfs-site.xml
[quote]
?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>
[/quote]
(3) edit mapred-site.xml
[quote]
<?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:8021</value>
</property>
</configuration>
[/quote]
(4)执行
[quote]
start-dfs.sh
start-mapred.sh
[/quote]
现在可以试用hadoop的威力了,如果不会用hadoop,这里有使用python的脚本方法
[url]
http://packages.python.org/mrjob/writing-and-running.html#running-on-your-own-hadoop-cluster
[/url]
只需要执行
[quote]python your_mr_job_sub_class.py -r hadoop < input > output[/quote]
非常方便
10 停止守护进程
[quote]
stop-dfs.sh
stop-mapred.sh
[/quote]
最后强烈推荐这本书,[url]http://product.china-pub.com/196200&ref=browse[/url]