实施hadoop-0.20.2完全分布式集群

集群规划

准备五台台虚拟机(实验以五台RedHat Enterprise Linux 6.5为例)

防火墙、iptables、和SSH已经在上一篇说过在此就不再赘述,完全分布式相对于伪分布式多了几个注意点,我们按照以下规划步骤来做:

  1. 配置hosts文件用于解析IP地址与主机名的映射
  2. 建立hadoop运行账号
  3. 配置SSH免密码登录
  4. 下载解压hadoop的安装包
  5. 配置jdk、hadoop环境变量
  6. 配置hadoop-env.sh,mapred-site.xml,core-site.xml,hdfs-site.xml,masters,slaves.
  7. 将配置好的文件复制到其他节点
  8. 格式化namenode并启动hadoop集群
  9. 检验集群健康情况

1.配置hosts文件

192.168.186.165 sishen.165
192.168.186.164 sishen.164
192.168.186.163 sishen.163
192.168.186.162 sishen.162
192.168.186.161 sishen.161

[[email protected] ~]# scp /etc/hosts sishen.162:/etc/

[[email protected] ~]# scp /etc/hosts sishen.163:/etc/

[[email protected] ~]# scp /etc/hosts sishen.164:/etc/

[[email protected] ~]# scp /etc/hosts sishen.165:/etc/

使用ping命令检验

[[email protected] ~]# ping -c 2 sishen.162
PING sishen.162 (192.168.186.162) 56(84) bytes of data.
64 bytes from sishen.162 (192.168.186.162): icmp_seq=1 ttl=64 time=29.2 ms
64 bytes from sishen.162 (192.168.186.162): icmp_seq=2 ttl=64 time=0.880 ms

--- sishen.162 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1012ms
rtt min/avg/max/mdev = 0.880/15.040/29.200/14.160 ms

2.建立hadoop运行账户

分别在五台机器上运行以下命令

[[email protected] ~]# useradd  hadoop
[[email protected] ~]# echo 123456 | passwd --stdin hadoop

建立hadoop的数据存放目录(注意:分别在五台机器上执行)

[[email protected] ~]# mkdir -p /hadoop-0.20.2/data
[[email protected] ~]# chown -R hadoop:hadoop /hadoop-0.20.2/
[[email protected] ~]# ll -d /hadoop-0.20.2/
drwxr-xr-x 3 hadoop hadoop 4096 Oct  9 14:33 /hadoop-0.20.2/

3.配置SSH免密码登录

分别在五台机器上运行以下命令

[[email protected] ~]# ssh-******

……

中间过程直接回车即可

…..

[[email protected] ~]# ssh-copy-id sishen.161

[[email protected] ~]# ssh-copy-id sishen.162

[[email protected] ~]# ssh-copy-id sishen.163

[[email protected] ~]# ssh-copy-id sishen.164

[[email protected] ~]# ssh-copy-id sishen.165

4.解压并配置hadoop软件包

解压hadoop压缩包

[[email protected] ~]# tar -xf hadoop-0.20.2.tar.gz -C /hadoop-0.20.2/

[[email protected] ~]# cd /hadoop-0.20.2/hadoop-0.20.2/conf/

开始配置hadoop
[[email protected] conf]# vim hadoop-env.sh

实施hadoop-0.20.2完全分布式集群

[[email protected] conf]# vim hdfs-site.xml

实施hadoop-0.20.2完全分布式集群

[[email protected] conf]# vim mapred-site.xml

实施hadoop-0.20.2完全分布式集群

[[email protected] conf]# vim core-site.xml

实施hadoop-0.20.2完全分布式集群

[[email protected] conf]# vim masters

实施hadoop-0.20.2完全分布式集群

[[email protected] conf]# vim slaves

实施hadoop-0.20.2完全分布式集群

[[email protected] hadoop-0.20.2]# scp hadoop.tar.gz sishen.162:/hadoop-0.20.2/

 

[[email protected] hadoop-0.20.2]# scp hadoop.tar.gz sishen.163:/hadoop-0.20.2/

[[email protected] hadoop-0.20.2]# scp hadoop.tar.gz sishen.164:/hadoop-0.20.2/

[[email protected] hadoop-0.20.2]# scp hadoop.tar.gz sishen.165:/hadoop-0.20.2/

启动hadoop集群

[[email protected] ~]# start-all.sh

检测守护进程

发现master上面如下进程

实施hadoop-0.20.2完全分布式集群

在salve节点上有如下进程

实施hadoop-0.20.2完全分布式集群

实施hadoop-0.20.2完全分布式集群

实施hadoop-0.20.2完全分布式集群

实施hadoop-0.20.2完全分布式集群

关闭集群

实施hadoop-0.20.2完全分布式集群

如有疏漏欢迎指正 ^_^!

posted on 2016-10-10 11:15 Lucky_7 阅读(...) 评论(...) 编辑 收藏

相关文章: