目录
一、简介
本文介绍使用HDP3.14+Ambari2.7.4安装,如果想使用其他的版本,可以去官网查询版本适配
另外,官网也有详细的指导安装流程,可以参照官网Installation
HADOOP主要有3个版本,
- Apache:原生版本,所有发行版均基于这个版本进行改进,
- Cloudera版本(Cloudera’s Distribution Including Apache Hadoop,简称CDH)
- Hortonworks版本(Hortonworks Data Platform,简称HDP,现已被CDH收购)
Ambari是一个基于web的工具,用于配置、管理、和监控hadoop集群。支持HDFS、Hive、Spark、MapReduce、Sqoop、Zookeeper、Kafka等服务,Ambari还提供了集群状况仪表盘。
HDP是hortonworks的软件栈,里面包含了hadoop生态系统的所有软件。
二、环境准备
机器 | 3台 |
安装包 | ambari,HDP,HDP-UTILS |
规格 | 3台服务器,4c16g |
系统 | centos7 |
软件 | java8,mysql7+,ambari-2.7.4.0-centos7.tar.gz、HDP-3.1.4.0-centos7-rpm.tar.gz、HDP-UTILS-1.1.0.22-centos7.tar.gz |
1.关闭防火墙
为了在安装过程中与它部署和管理的主机通信,某些端口必须是开放的和可用的。最简单的方法是暂时禁用iptables
systemctl status firewalld # 通过此命令查看防火墙状态
systemctl stop firewalld # 关闭防火墙
systemctl disable firewalld # 关闭防火墙开机自启
安装完成后,可以重新启动iptables。如果您的环境中的安全协议不允许禁用iptables,那么如果所有所需的端口都是开放的且可用的,那么您可以继续启用iptables。
Ambari在Ambari服务器设置过程中检查iptables是否正在运行。如果iptables正在运行,将显示一个警告,提醒您检查所需的端口是否开放且可用。“群集安装向导”中的“主机确认”步骤还会对运行iptables的每台主机发出警告。
2.修改主机名
修改本机名
hostnamectl set-hostname hdp01
设置好之后可以查看修改之后的本机名,注意要加上-f
hostname -f
3.配置域名映射
三台机器都 vim /etc/hosts文件,使3台机器之间可以通过hdp01,hdp02,hdp03访问,不要删除前2行
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
ip1 hdp01
ip2 hdp02
ip3 hdp03
修改完之后,可通过scp命令将hosts文件发送到其他虚拟机。
scp /etc/hosts hdp02:/etc/
scp /etc/hosts hdp03:/etc/
测试是否可以通过ping主机名找到对应服务器
ping hdp01
4.配置网络文件
每台主机设置所需的网络配置 vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=<fully.qualified.domain.name>
5.检查最大文件打开数
建议打开的文件描述符的最大数量为10000或更多。在每台机器上执行
//查看文件最大打开数
ulimit -Sn
ulimit -Hn
//如果文件最大打开数低于1W,则设置为1W
ulimit -n 10000
6.配置免密
配置hdp01分别到hdp01,hdp02,hdp03的免密登录。
参照centos免密登录_q495673918的博客-CSDN博客
7.时间同步
如果每台机器都可以访问网络则直接每台机器都安装ntp服务
yum install -y ntp
systemctl enable ntpd
如果只有一台机器可以访问网络则这里选一台服务器作时间服务器,这里以hdp1作为时间服务器,其他服务器以时间服务器时间为准
1.时间服务器配置(root用户)
1.安装ntp服务
yum install -y ntp
2.修改ntp配置文件
修改/etc/ntp.conf文件
vi /etc/ntp.conf
2.1 授权192.168.1.0-192.168.1.255网段上的所有机器可以从这台机器上查询和同步时间
修改
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
为
restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap #我这里使用的网段为80,具体网段根据服务器的ip而定
2.2 集群在局域网和非局域网时间配置
集群在局域网中,不使用其他互联网上的时间
修改
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
为
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
集群使用互联网时间,这里使用阿里云时间服务器的时间
# 将原来的注释掉
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
# 添加如下
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
server ntp4.aliyun.com iburst
server ntp5.aliyun.com iburst
server ntp6.aliyun.com iburst
server ntp7.aliyun.com iburst
2.3 当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步
server 127.127.1.0
fudge 127.127.1.0 stratum 10
3.启动ntp服务并设置开机自启
systemctl start ntpd # 启动ntpd服务
systemctl enable ntpd # 配置ntpd服务开机自启
2.其他服务器配置(root用户)
1.非时间服务器都安装ntpdate服务
yum install -y ntpdate
2.同步时间
ntpdate hdp1
3.定时同步时间
通过crontab编写定时任务
crontab -e
# 添加如下内容
29,59 * * * * /usr/sbin/ntpdate hdp1 # 每小时的第29分和59分同步一次时间
到达时间点后通过date
命令查看时间是否已经同步,当然配置间隔时间更短的任务,这样可以更快的看到效果。
8.安装JDK(所有节点)
参照centos7下通过yum安装java8_q495673918的博客-CSDN博客
9.安装mysql
参照centos下mysql5.7安装_q495673918的博客-CSDN博客
10.上传安装包
ambari和hdp的包比较大,且因为是国外的网站下载速度感人,最不幸的是现在hdp官网已经要收费了,所以我们使用迅雷下载,迅雷有缓存服务器不会直接连国外的网站,所以要快很