用vmware搭建三台Linux虚拟机,具体步骤如下:
1、hadoop下载地址:http://www.apache.org/dyn/closer.cgi/hadoop/core/
2、下载java6软件包,分别在三台安装
3、三台虚拟机,一台作为master,另外两台作为slave,分别配置/etc/hosts
172.16.130.136 masternode
172.16.130.137 slavenode1
172.16.130.138 slavenode2
4、在三台主机/etc/profile设置环境变量
export JAVA_HOME=/usr/java/jdk1.6.0_13
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export HADOOP_HOME=/home/hduser/hadoop
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$PATH
5、在三台机器上建立hadoop用户和组
groupadd hadoop
useradd -g hadoop hduser
6、在masternode节点创建SSH安全认证
$ ssh-keygen -t rsa -P ""
$cd .ssh
$ cat id_rsa.pub>>authorized_keys
$ssh masternode
$ssh slavenode1
$ssh slavenode2
将授权的文件分别拷贝到slavenode1和slavenode2,检查ssh登陆主机是否需要密码。
7、上传hadoop软件包到hadoop用户目录下解压
tar xvf hadoop*.gz
8、添加$HADOOP_HOME/conf/hadoop-env.sh
export JAVA_HOME=/usr/java/jdk1.6.0_13
9、编辑$HADOOP_HOME/conf/core-site.xml
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hduser/hadoop/tmp</value>
<description>.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://masternode:54310</value>
<description> </description>
</property>
</configuration>
10、编辑$HADOOP_HOME/conf/mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>masternode:54311</value>
<description>. </description>
</property>
</configuration>
11、编辑$HADOOP_HOME/conf/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>3</value>
<description>. </description>
</property>
</configuration>
12、编辑$HADOOP_HOME/conf/masters
masternode
13、编辑$HADOOP_HOME/conf/slaves
slavenode1
slavenode2
14、在所有机器上创建/home/hduser/hadoop/tmp
15、拷贝masternode上$HADOOP_HOME文件拷贝到各个节点上
16、在masternode进行格式化
hadoop -namenode -format
17、启动
start-all.sh
jps命令查看
18、访问masternode http://172.16.130.136:50030
访问slavenode http://172.16.130.137:50060