Ambari 跟 Hadoop 等开源软件一样,也是 Apache Software Foundation 中的一个项目,并且是*项目。就 Ambari 的作用来说,就是创建、管理、监视 Hadoop 的集群,但是这里的 Hadoop 是广义,指的是 Hadoop 整个生态圈(例如 Hive,Hbase,Sqoop,Zookeeper 等等),而并不仅是特指 Hadoop。用一句话来说,Ambari 就是为了让 Hadoop 以及相关的大数据软件更容易使用的一个工具。
安装说明
安装ambari前先安装好 Centos 7并更新。要确保之前没有安装过Ambari,并且没有搭建过hadoop环境,均是新安装的系统,未做任何设置。
配置SSH免密登陆
不做详细介绍,运维必会技能
查看selinux状态,并关闭
vi /etc/sysconfig/selinux
SELINUX=disabled
制作本地源
由于GFW问题,需在本机**单独下载安装
关闭防火墙
yum install httpd
systemctl start httpd.service
systemctl enable httpd.service
安装制作本地源工具
yum install yum-utils createrepo
下载安装资源
ambari下载资源
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.1.0/ambari.repo
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.1.0/ambari-2.6.1.0-centos7.tar.gz
hdp下载资源
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/hdp.repo
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/HDP-2.6.5.0-centos7-rpm.tar.gz
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz
在httpd网站根目录,默认是即/var/www/html/,创建目录repository(自定义名字,自己根据情况命名),并且将下载的压缩包解压到/var/www/html/ambari目录。
tar -zxvf ambari-2.6.1.0-centos7.tar.gz -C /var/www/html/repository/
tar -zxvf HDP-2.6.5.0-centos7-rpm.tar.gz -C /var/www/html/repository/
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/repository/
配置ambari、HDP、HDP-UTILS的本地源
vi ambari.repo
[ambari-2.6.1.0]
name=ambari Version - ambari-2.6.1.0
baseurl=http://prod-pinpoint-01/repository/ambari/centos7/2.6.1.0-143/
gpgcheck=1
gpgkey=http://prod-pinpoint-01/repository/ambari/centos7/2.6.1.0-143//RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
vi hdp.repo
VERSION_NUMBER=2.6.5.0-292
[HDP-2.6.5.0]
name=HDP Version - HDP-2.6.5.0
baseurl=http://prod-pinpoint-01/repository/HDP/centos7/2.6.5.0-292/
gpgcheck=1
gpgkey=http://prod-pinpoint-01/repository/HDP/centos7/2.6.5.0-292/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://prod-pinpoint-01/repository/HDP-UTILS/centos7/1.1.0.22/
gpgcheck=1
gpgkey=http://prod-pinpoint-01/repository/HDP-UTILS/centos7/1.1.0.22//RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
将上面的修改过的源放到/etc/yum.repos.d/下面
mv ambari.repo /etc/yum.repos.d/
mv hdp.repo /etc/yum.repos.d/
更新yum
yum clean all
yum list update
yum makecache
yum repolist
安装Mysql数据库
下载repo源
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
安装rmp包
rpm -ivh mysql57-community-release-el7-8.noarch.rpm --nodeps --force
安装Mysql
yum install mysql-server
启动Mysql
systemctl start mysqld
重置root密码
grep 'temporary password' /var/log/mysqld.log
修改root密码
mysql -u root -p
mysql> Enter password: (输入刚才查询到的随机密码)
mysql> SET PASSWORD FOR 'root'@'localhost'= "xxxxxx";
mysql> exit
开放3306
mysql>GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'xxxxx' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
mysql>exit;
创建ambari数据库及用户
create database ambari character set utf8 ;
CREATE USER 'ambari'@'%'IDENTIFIED BY 'xxxx';
GRANT ALL PRIVILEGES ON . TO 'ambari'@'%';
FLUSH PRIVILEGES;
安装mysql jdbc驱动
yum install mysql-connector-java
安装ambari
安装
yum install ambari-server
配置
ambari-server setup
提示是否自定义设置。输入:y
Customize user account for ambari-server daemon y/n?
ambari-server 账号。输入:ambari,默认为root
Enter user account for ambari-server daemon (root):ambariAdjusting ambari-server permissions and ownership...
检查防火墙,如果关闭则不用操作。
Enter user account for ambari-server daemon (root):ambariAdjusting ambari-server permissions and ownership...
检查JDK
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
Enter choice (1):3
置JAVA_HOME
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: /opt/java
配置数据库
Configuring database...
Enter advanced database configuration y/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
设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车。
Enter choice (1): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):
Re-enter password:
Configuring ambari database...
设置数据库连接属性,完成配置。
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
Proceed with configuring remote database connection properties y/n? y
Extracting system views...
....ambari-admin-2.6.2.0.155.jar
.......
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
将Ambari数据库脚本导入到数据库
mysql> use ambari;
Database changed
mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
启动ambari
ambari-server start
配置nginx转发到ambari的服务器上,暴露服务
出现登录界面,默认管理员账户登录, 账户:admin 密码:admin,登陆并修改密码
登录成功后出现下面的界面,至此Ambari的安装成功
点击上面登录成功页面的Launch Install Wizard 按钮进行集群配置
点击Add Version添加自己下载的HDP版本
弹出的窗口中指定之前配置的HDP源中HDP版本文件,然后点击Read Version Info按钮,确定版本信息
因为HDP安装包非常大,不建议采用Public Repository,本次安装采用Local Repository,前边已经配置完成,此处只需指定为前边所配置的本地源地址即可,如下图所示。
设置集群信息,并配置ambari-server ssh私钥信息(前提是已经完成集群机器ssh的配置)