hadoop 单机环境安装步骤
1)http://hadoop.apache.org/下载hadoop Release 1.2.1版本
2)解压到本地文件系统中,我将其解压到~/opt下
$cd ~/opt
$tar xzf hadoop-1.2.1.tar.gz
3)设置环境变量
编辑~/.bashrc,添加JAVA_HOME,PATH
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
PATH=$PATH:/home/qhwang/opt/hadoop-1.2.1/bin
保存文件,重新启动系统。
4)输入以下命令查看hadoop是否能运行
$hadoop version
Hadoop 0.23.9
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23.9/hadoop-common-project/hadoop-common -r 1498472
Compiled by tgraves on Mon Jul 1 14:44:38 UTC 2013
From source with checksum 187fcd01f96ad016b0400952319dccdc
hadoop 伪分布模式配置
2)安装配置ssh
$sudo apt-get install ssh
基于空口令创建一个新SSH密钥,以启动无密码登录
$ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
测试ssh是否配置成功
$start-dfs.sh
$start-mapred.sh
$stop-dfs.sh
$stop-mapred.sh
在http://localhost:50030查看jobtracker,在http://localhost:50070查看namenode
附录:
hadoop官方站点:http://hadoop.apache.org/
hadoop官方wiki:http://wiki.apache.org/hadoop/
1)http://hadoop.apache.org/下载hadoop Release 1.2.1版本
2)解压到本地文件系统中,我将其解压到~/opt下
$cd ~/opt
$tar xzf hadoop-1.2.1.tar.gz
3)设置环境变量
编辑~/.bashrc,添加JAVA_HOME,PATH
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
PATH=$PATH:/home/qhwang/opt/hadoop-1.2.1/bin
保存文件,重新启动系统。
4)输入以下命令查看hadoop是否能运行
$hadoop version
Hadoop 0.23.9
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23.9/hadoop-common-project/hadoop-common -r 1498472
Compiled by tgraves on Mon Jul 1 14:44:38 UTC 2013
From source with checksum 187fcd01f96ad016b0400952319dccdc
hadoop 伪分布模式配置
1)配置conf目录下的core-site.xml,hdfs-site.xml,mapred-site.xml
core-site.xml<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost/</value>
</property>
</configuration>
hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
mapred-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:8021</value>
</property>
</configuration>
2)安装配置ssh
$sudo apt-get install ssh
基于空口令创建一个新SSH密钥,以启动无密码登录
$ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
测试ssh是否配置成功
$ssh localhost
$hadoop namenode -format
$start-dfs.sh
$start-mapred.sh
$stop-dfs.sh
$stop-mapred.sh
在http://localhost:50030查看jobtracker,在http://localhost:50070查看namenode
附录:
hadoop官方站点:http://hadoop.apache.org/
hadoop官方wiki:http://wiki.apache.org/hadoop/