Hadoop 三节点集群安装配置详细实例

topo节点:
192.168.10.46 Hadoop46
192.168.10.47 Hadoop47
192.168.10.48 Hadoop48
Hadoop的守护进程deamons:NameNode/DataNode 和 JobTracker/TaskTracker。其中NameNode/DataNode工作在HDFS层,JobTracker/TaskTracker工作在MapReduce层。
设备列表中Hadoop48是master,担任namenode和jobtracker,46,47为slave,担任datanode和tasktracker。secondary namenode在hadoop 1.03中被废弃,用checkpoint node或backupnode来代替。暂没有配checkpoint node或backupnode。

Hadoop 三节点集群安装配置详细实例

hadoop topo

在各机器建立用户zhouhh,可选自己喜欢的名称,用于管理hadoop。

网络准备
先对每个节点完成单节点设置,见我此前文章:快速搭建Hadoop环境并测试mapreduce


从下载最新版本hadoop

wget
然后分发到各机器,并在各机器解压,配置,测试单台设备ok。
[@Hadoop48 ~]$ cat /etc/RedHat-release
CentOS release 5.5 (Final)

[@Hadoop48 ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.10.46 Hadoop46
192.168.10.47 Hadoop47
192.168.10.48 Hadoop48

[@Hadoop48 ~]$ ping Hadoop46
PING Hadoop46 (192.168.10.46) 56(84) bytes of data.
64 bytes from Hadoop46 (192.168.10.46): icmp_seq=1 ttl=64 time=5.25 ms
64 bytes from Hadoop46 (192.168.10.46): icmp_seq=2 ttl=64 time=0.428 ms

— Hadoop46 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1009ms
rtt min/avg/max/mdev = 0.428/2.843/5.259/2.416 ms
[@Hadoop48 ~]$ ping Hadoop47
PING Hadoop47 (192.168.10.47) 56(84) bytes of data.
64 bytes from Hadoop47 (192.168.10.47): icmp_seq=1 ttl=64 time=7.08 ms
64 bytes from Hadoop47 (192.168.10.47): icmp_seq=2 ttl=64 time=4.27 ms

— Hadoop47 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1007ms
rtt min/avg/max/mdev = 4.277/5.678/7.080/1.403 ms

[@Hadoop48 ~]$ ssh-keygen -t rsa -P “”
[@Hadoop48 ~]$ cd .ssh
[@Hadoop48 .ssh]$ cat id_rsa.pub >> authorized_keys

由于安全原因,如果各节点的ssh连接不是标准端口,可以配置一个config文件,以方便ssh Hadoop46这样的命令自动连接。
如果是标准端口标准key文件名的话通过hosts的解析就可以用ssh Hadoop46这样的命令自动登录了。
config文件格式:

[@Hadoop48 .ssh]$ vi configHost Hadoop46 Port 22 HostName 192.168.10.46 IdentityFile ~/.ssh/id_rsa Host Hadoop47 Port 22 HostName 192.168.10.47 IdentityFile ~/.ssh/id_rsa Host Hadoop48 Port 22 HostName 192.168.10.48 IdentityFile ~/.ssh/id_rsa[@Hadoop48 ~]$ ssh-copy-id -i .ssh/id_rsa @Hadoop46 [@Hadoop48 ~]$ ssh-copy-id -i .ssh/id_rsa @Hadoop47测试用key实现无密码登录,都应该成功: [@Hadoop48 ~]$ ssh Hadoop46 [@Hadoop48 ~]$ ssh Hadoop47 [@Hadoop48 ~]$ ssh Hadoop48拷贝私钥: [@Hadoop47 .ssh]$ scp @Hadoop48:~/.ssh/id_rsa . [@Hadoop47 .ssh]$ scp @Hadoop48:~/.ssh/config . [@Hadoop46 .ssh]$ scp @Hadoop48:~/.ssh/id_rsa . [@Hadoop46 .ssh]$ scp @Hadoop48:~/.ssh/config . 至此,完成了互联互通。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/f92fb26a54a6417e4f91d1b5c8d089dd.html