Ambari已支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、Hbase、Zookeeper、Sqoop和Hcatalog等。Ambari是一个基于web的工具,用于配置、管理和监视Hadoop集群,同样还提供了集群状况仪表盘,通过界面方便用户查看问题及管理组件。
根据网上了解到Ambari2.7.4+HDP3.1.4安装Ambari2.7.4+HDP3.1.4是最后一个免费版本,新的版本需要授权才能使用,并且Apache好像已经停止了对Ambari项目的维护。但是依然可以正常安装使用,下面是个人安装的详细步骤。
目录
一、安装包需要
二、服务器准备
三、解压并准备yarn源
四、安装MySQL(已安装忽略)
五、安装启动
六、集群安装
安装需要Ambari、HDP和HDP-UTILS,JDK1.8及MySQL库连接驱动包:
Ambari是一个基于web的工具,用于配置、管理和监视Hadoop集群,还提供了集群状况仪表盘,方便用户管理;
HDP是hortonworks的软件栈,里面包含了hadoop生态系统的所有软件项目;
HDP-UTILS是工具类库;
JDK1.8;
MySQL驱动包。
Ambari-2.7.4和HDP-3.1.4下载 ,提取码:3rwq
1.准备三台服务器(多台),均为centos7系统,分别修改主机名为hdp01、hdp02、hdp03。
修改/etc/hosts文件如下:
[root@master ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.x.x hdp01
192.168.x.x hdp02
192.168.x.x hdp03
使用 hostnamectl set-hostname hdp01 命令修改本机名称,同样修改其他两台服务器名称:
[root@localhost ~]# hostnamectl set-hostname hdp01
[root@localhost ~]# hostname
hdp01
2.保证三台免密互通,且都安装了JDK1.8,加入环境变量。
3.关闭防火墙
所有服务器都需要关闭防火墙。
查看防火墙状态:firewall-cmd --state
关闭防火墙:systemctl stop firewalld.service
4.安装ntp服务
同步时钟,所有服务器都需安装。
yum -y install ntp
5.安装httpd服务
在主节点服务器安装httpd。
yum -y install httpd #安装
systemctl start httpd #启动
systemctl status httpd #查看启动状态
chkconfig httpd on #设置开机启动
1.主节点服务器创建/var/www/html/目录,先将ambari解压到该目录
[root@localhost ambari]# tar -zxvf ambari-2.7.4.0-centos7.tar.gz -C /var/www/html/
在/var/www/html/下创建hdp目录,将另外的两个压缩包解压到该目录中
tar -zxvf HDP-3.1.4.0-centos7-rpm.tar.gz -C /var/www/html/hdp/
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/hdp/
2.配置yarn源
1)vi /etc/yum.repos.d/ambari.repo,在该文件中加入以下配置:
[ambari-2.7.4.0]
name=ambari
baseurl=http://192.168.x.x/ambari/centos7/2.7.4.0-118
gpgkey=http://192.168.x.x/ambari/centos7/2.7.4.0-118/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
gpgcheck=1
enabled=1
priority=1
2) vi /etc/yum.repos.d/hdp.repo,在该文件中加入以下配置:
[HDP-3.1.4.0]
name=HDP Version - HDP-3.1.4.0
baseurl=http://192.168.x.x/hdp/HDP/centos7/3.1.4.0-315/
gpgcheck=1
gpgkey=http://192.168.x.x/hdp/HDP/centos7/3.1.4.0-315/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://192.168.x.x/hdp/HDP-UTILS/centos7/1.1.0.22/
gpgcheck=1
gpgkey=http://192.168.x.x/hdp/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
3.安装createrepo
yum install yum-utils createrepo yum-plugin-priorities -y
生成本地源
createrepo ./
4.依次执行命令,清理yum缓存
[root@hdp01 ambari]# yum clean all
[root@hdp01 ambari]# yum makecache
[root@hdp01 ambari]# yum repolist
5.将创建好的两个文件分别分发到另外两台服务器
scp /etc/yum.repos.d/ambari.repo root@hdp02:/etc/yum.repos.d
scp /etc/yum.repos.d/ambari.repo root@hdp03:/etc/yum.repos.d
scp /etc/yum.repos.d/hdp.repo root@hdp02:/etc/yum.repos.d
scp /etc/yum.repos.d/hdp.repo root@hdp03:/etc/yum.repos.d
可切换到 /etc/yum.repos.d/ 目录同时scp两个文件。
安装好MySQL数据库后,设置允许远程连接。我这是安装的MySQL8.0.11。
将准备好的MySQL驱动放在 /usr/share/java/ 目录下。
数据库安装好后创建ambari数据库:
[root@hdp01 jvm]# mysql -uroot -proot
mysql> create database ambari;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ambari |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
初始化数据库:
mysql> use ambari
Database changed
mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
执行完后会在ambari库中建相关表。
1.查看Java路径
[root@hdp01 bin]# echo $JAVA_HOME
记下该路径后面使用。
2.先执行ambari-server setup
[root@hdp01 jvm]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'permissive'
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y #这里之前在设置关闭SELinux 时没有重启机器报警了,不影响
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):root #设置账号为root
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 #选择2表示自定义安装的JDK
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/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64
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 #选择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 #这里选择mysql
Hostname (localhost): #直接回车默认localhost
Port (3306): #直接回车默认3306
Database name (ambari): #直接回车默认ambari
Username (ambari): root #root用户
Enter Database Password (bigdata): #输入数据库密码root
Re-enter password: #再次输入数据库密码root
Configuring ambari database...
Enter full path to custom jdbc driver: /usr/share/java/mysql-connector-java-8.0.11.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)?
Extracting system views...
ambari-admin-2.7.4.0.118.jar
....
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully. #到这里表示ambari-server已经安装成功
3.启动ambari-server
[root@hdp01 ~]# 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.
默认是8080端口,修改端口可在/etc/ambari-server/conf/ambari.properties文件中新增一行:
client.api.port=指定端口
如果启动失败,可查看/var/log/ambari-server/ambari-server.log,分析原因。
记录下我启动的时候出现的错误:
1)Table 'ambari.members' doesn't exist Error Code: 1146...
解决方法:
在ambari库中创建表:
CREATE TABLE members (
member_id INTEGER,
group_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
CONSTRAINT PK_members PRIMARY KEY (member_id),
# FOREIGN KEY (group_id) REFERENCES groups(group_id),
# FOREIGN KEY (user_id) REFERENCES users(user_id),
CONSTRAINT UNQ_members_0 UNIQUE (group_id, user_id));
2)启动超时错误
在/etc/ambari-server/conf/ambari.properties文件中增加配置:
server.startup.web.timeout=150
Ambari启动成功后,在浏览器访问 8080 端口进入登录页面,账号密码默认都是admin,进入后可按步骤进行后续安装配置,等待完成集群安装。