Apache Ambari是一种基于Web的工具,支持Apache Hadoop集群的创建、管理和监控。Ambari已支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeeper、Sqoop和Hcatalog等;除此之外,Ambari还支持Spark、Storm等计算框架及资源调度平台YARN。
Ambari 自身也是一个分布式架构的软件,主要由两部分组成:Ambari Server 和 Ambari Agent。简单来说,用户通过Ambari Server通知 Ambari Agent 安装对应的软件;Agent 会定时地发送各个机器每个软件模块的状态给 Ambari Server,最终这些状态信息会呈现在 Ambari 的 GUI,方便用户了解到集群的各种状态,并进行相应的维护。
一、搭建内部yum源
网络原因,直接安装速度将会特别慢甚至失败,下载镜像搭建一个内部yum源
1、下载文件(可评论找我发)
Ambari、HDP 、HDP-GPL 和 HDP-UTILS
2、解压并转存到指定路径,使用httpd或者nginx方式访问
http 将解压文件放在: /var/www/html
nginx 开启浏览目录:autoindex_localtime on;
配置内网能访问到的地址

3、新增 /etc/yum.repos.d/ambari.repo
[ambari-2.7.5.0]
name=ambari Version - ambari-2.7.5.0
baseurl=http://127.0.0.1/ambari/ambari/centos7/2.7.5.0-72/
gpgcheck=1
gpgkey=http://127.0.0.1/ambari/ambari/centos7/2.7.5.0-72/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-3.1.5.0]
name=HDP Version - HDP-3.1.5.0
baseurl=http://127.0.0.1/ambari/HDP/centos7/3.1.5.0-152
gpgcheck=1
gpgkey=http://127.0.0.1/ambari/HDP/centos7/3.1.5.0-152/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://127.0.0.1/ambari/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
gpgkey=http://127.0.0.1/ambari/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
二、安装ambari-server
yum install -y ambari-server && yum clean all
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.49.tar.gz
wget https://jdbc.postgresql.org/download/postgresql-42.3.1.jar
导入mysql
mysql -h127.0.0.1 -P3306 -uroot -p'123456' <<EOF
CREATE DATABASE ambari;
use ambari;
CREATE USER 'ambari'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
CREATE USER 'ambari'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
FLUSH PRIVILEGES;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
show tables;
EOF
开始安装服务
[root@amb001 ~]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 2
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/local/jdk1.8.0_311
Validating JDK on Ambari Server...done.
Check JDK version for Ambari Server...
JDK version found: 8
Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? y
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (1): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari): root
Enter Database Password (bigdata):
Re-enter password:
Configuring ambari database...
Enter full path to custom jdbc driver: /usr/share/java/mysql-connector-java-5.1.49.jar
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL directly from the database shell to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
Proceed with configuring remote database connection properties [y/n] (y)? y
Extracting system views...
.....
Ambari repo file contains latest json url http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json, updating stacks repoinfos with it...
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
[root@amb081 ~]# ambari-server status
Using python /usr/bin/python
Ambari-server status
Ambari Server not running.
[root@amb081 ~]# 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...
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....................................................................
Server started listening on 8080
DB configs consistency check: no errors and warnings were found.
Ambari Server 'start' completed successfully.
[root@amb001 ~]#
修改配置
vim /etc/systemd/system/ambari-server.service
[Install]
WantedBy=multi-user.target
[Unit]
Description=Ambari Server Service
After=network-online.target network.service
[Service]
Type=forking
Restart=on-failure
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
Environment='AMBARI_JVM_ARGS=-XX:MaxPermSize=512m'
ExecStart=/usr/sbin/ambari-server start
ExecStop=/usr/sbin/ambari-server stop
最后启动
ambari-server start
systemctl enable ambari-server
启动没有报错则可访问8080端口打开web后台
三、安装ambari-agent
yum install -y ambari-agent && yum clean all
vim /etc/systemd/system/ambari-agent.service
[Install]
WantedBy=multi-user.target
[Unit]
Description=Ambari Agent Service
After=network-online.target network.service
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/rc.d/init.d/ambari-agent start
ExecStop=/etc/rc.d/init.d/ambari-agent stop
最后启动agent
ambari-agent start
systemctl enable ambari-agent