一、hadoop集群搭建
先建好三个虚拟机:hadoop1、hadoop2、hadoop3
再利用xshell连接三台虚拟机
在xshell中进行操作:
上传文件到hadoop1,下载一个lrzsz包:
[root@hadoop1 hadoop]# yum -y install -y lrzsz
1.首先在/home新建文件夹
[root@hdp01 home]# mkdir -p /home/hadoop/apps
2.在apps目录下上传文件
将windows中的两个文件传到linux虚拟机中
[root@hadoop1 home]#cd /home/hadoop/apps
[root@hadoop1 home]#rz
二、集群
1.集群简介
HADOOP集群具体来说包含两个集群:HDFS集群和YARN集群,两者逻辑上分离,但物理上常在一起
HDFS集群:负责海量数据的存储,集群中的角色主要有 NameNode / DataNode
YARN集群:负责海量数据运算时的资源调度,集群中的角色主要有 ResourceManager /NodeManager
2.服务器准备
Vmware 11.0
Centos 6.5 64bit
3.网络环境准备
采用NAT方式联网
网关地址:192.168.91.2
3个服务器节点IP地址:192.168.91.110、192.168.91.120、192.168.91.130
子网掩码:255.255.255.0
4.服务器系统设置
设置主机名
hadoop1
hadoop2
hadoop3
配置内网域名映射:
192.168.91.110 hadoop1
192.168.91.120 hadoop2
192.168.91.130 hadoop3
配置host文件
[root@hadoop1 hadoop]# vi /etc/hosts
添加: 192.168.91.110 hadoop1 192.168.91.120 hadoop2 192.168.91.130 hadoop3
配置ssh免密登陆
[root@hadoop1 hadoop]# ssh-keygen
yum安装ssh服务 在三个节点都要安装
[root@hadoop1 hadoop]# yum -y install openssh-clients.x86_64
[root@hadoop2 hadoop]# yum -y install openssh-clients.x86_64
[root@hadoop3 hadoop]# yum -y install openssh-clients.x86_64
将生成的秘钥发到hadoop1、hadoop2、hadoop3上
[root@hadoop1 hadoop]# ssh-copy-id hadoop1
[root@hadoop2 hadoop]# ssh-copy-id hadoop2
[root@hadoop3 hadoop]# ssh-copy-id hadoop3
在hadoop1上测试一下,看一看能不能不输入密码,就能登录到hadoop2、hadoop3上
[root@hadoop1 hadoop]# ssh hadoop2
[root@hadoop1 hadoop]# ssh hadoop3
查看防火墙:必须关闭
[root@hadoop2 ~]# service iptables status
[root@hadoop3 ~]# service iptables status