原文:
https://www.jianshu.com/p/73f9670f71cf
部署环境使用4台机器,OS使用CentOS7,部署图如下:

Paste_Image.png
环境准备
1、节点间互信
# ssh-keygen -t rsa
# cat .ssh/id_rsa.pub >> .ssh/authorized_keys
# scp .ssh/authorized_keys hadoop-node1:~/.ssh/authorized_keys
将所有节点的rsa公钥信息都保存到authorized_keys文件中,并且保存到每个节点~/.ssh/目录里。然后验证一下。
# ssh hadoop-node1 date
Fri Mar 24 13:27:12 CST 2017
2、关闭防火墙、selinux
# systemctl stop firewalld
# systemctl disable firewalld
# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
# setenforce 0
# vi /etc/sysconfig/selinux
SELINUX=disabled
安装Ambari-server
在控制节点上,安装ambari-server包(关于ambari编译,请参考另一篇文章“Ambari 2.4.2源代码编译”)及其依赖。
# yum install ambari-server -y
配置ambari server。
# ambari-server setup
/usr/sbin/ambari-server: line 33: buildNumber: unbound variable
查看执行脚本,发现33行buildNumber环境变量没有定义值。
# export buildNumber=2.4.2.0
# ambari-server setup

询问daemon的用户账号,使用默认root用户即可。

检查防火墙和配置JDK。

配置数据库,选择1,其余默认即可。
完成ambari-server的配置。
启动ambari-server。
# ambari-server start
Using python /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
No errors were found.
Ambari database consistency check finished
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start....................
Ambari Server 'start' completed successfully.
在受控节点上,安装Ambari-agent
# yum install ambari-agent -y
# vi /etc/ambari-agent/conf/ambari-agent.ini
[server]
#改为控制节点的机器名(IP也可)
hostname=hadoop-node0
# scp /etc/ambari-agent/conf/ambari-agent.ini
hadoop-node2:/etc/ambari-agent/conf/ambari-agent.ini
# scp /etc/ambari-agent/conf/ambari-agent.ini
hadoop-node3:/etc/ambari-agent/conf/ambari-agent.ini
启动agent。
# export buildNumber=2.4.2.0
# ambari-agent start
Verifying Python version compatibility...
Using python /usr/bin/python
Checking for previously running Ambari Agent...
Starting ambari-agent
Verifying ambari-agent process status...
Ambari Agent successfully started
Agent PID at: /run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log
使用Ambari部署Hadoop集群
打开浏览器,访问http://<ambari-server-host>:8080。

http://hadoop-node0:8080
用户名密码使用admin/admin。

登录首页
1) 为集群定义名称

定义名称
2) 选择部署版本

选择部署版本
3) 安装选项

选项
因为前面已经安装了agent。所以这里选择手工注册。

警告

注册成功
注意:Target Hosts应填写主机名。
4) 选择安装的服务

服务列表
5)各服务的master配置情况

各服务master配置部署情况
6) 各服务的slave/client配置情况

各服务的slave/client配置情况
7)自定义配置部分

自定义配置

Ambari Metrices配置
注:密码都配置为“123456”。
8)Review配置信息

Review配置信息
9)开始安装、启动、测试

开始安装

完成安装检验
10)总结

总结
11)完成集群部署,显示集群状态

集群状态
注意:
在安装过程中,配置HDP的URL时,由于网络问题,经常失败,可以下载下面的包,自己创建yum源来解决传输慢的问题。
作者:mikeliuy
链接:https://www.jianshu.com/p/73f9670f71cf
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。