1、环境说明
系统:CentOS release 6.3 64bit
java:Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Hadoop:1.2.1
本次实验包括:1个Master,3个Salve,节点之间局域网连接,可以相互ping通,
节点IP地址分布如下:
192.168.1.102 Master.Hadoop
192.168.1.100 Slave1.Hadoop
192.168.1.101 Slave2.Hadoop
192.168.1.103 Slave3.Hadoop
修改主机名、修改IP地址,这里不做简述。
2、修改/etc/hosts
在/etc/hosts 下添加如下
192.168.1.102 Master.Hadoop
192.168.1.100 Slave1.Hadoop
192.168.1.101 Slave2.Hadoop
192.168.1.103 Slave3.Hadoop
3、软件下载1.4 所需软件
1)JDK软件
JDK版本:jdk-7u40-linux-x64.gz
2)Hadoop软件
Hadoop版本:hadoop-1.2.1.tar.gz
软件下载好。上传到Master.Hadoop 的/soft下
4、ssh互信设置
1)创建用记
useradd hadoop
2)在每台主机上以hadoop用户执行
mkdir~/.ssh
chmod 700~/.ssh
ssh-keygen -t rsa
3).在主节点以上root用户执行以下操作
ssh Master.Hadoop cat ~/.ssh/id_rsa.pub>> ./.ssh/authorized_keys
ssh Slave1.Hadoop cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
sshSlave2.Hadoop cat ~/.ssh/id_rsa.pub>> ~/.ssh/authorized_keys
sshSlave3.Hadoop cat ~/.ssh/id_rsa.pub>> ~/.ssh/authorized_keys
chmod 600~/.ssh/authorized_keys
4)复制到每台主机
scp~/.ssh/authorized_keys Master.Hadoop:~/.ssh/authorized_keys
scp~/.ssh/authorized_keys Slave1.Hadoop:~/.ssh/authorized_keys
scp~/.ssh/authorized_keys Slave2.Hadoop:~/.ssh/authorized_keys
scp~/.ssh/authorized_keys Slave3.Hadoop:~/.ssh/authorized_keys
5)测试
ssh Master.Hadoopdate
ssh Slave1.Hadoopdate
ssh Slave2.Hadoopdate
ssh Slave3.Hadoopdate
如果不用密码直接登陆就代表已经成功
5、安装Java
在每一台主机上都安装
1)、以root用户执行
mkdir /usr/java
cd /soft/
gunzip jdk-7u40-linux-x64
tar -xvf jdk-7u40-linux-x64
mv jdk1.7.0_40 /usr/java/.
2)、配置环境变量
在/etc/profile结尾处加如下
cat>>/etc/profile<<EOF
------------------------------------------------------------------------
# set java environment
export JAVA_HOME=/usr/java/jdk1.7.0_40/
export JRE_HOME=/usr/java/jdk1.7.0_40/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
EOF
--------------------------------------------------------------------------
3)、生效变量
source /etc/profile
4)、验证安装
java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)