Ambari 离线安装(centos7.3)

前期准备

配置主机hosts(每台机器都要配置/etc/hosts)

192.168.111.65  ambari-65
192.168.111.66  ambari-66
192.168.111.67  ambari-67

SSH免密登录配置

ssh-copy-id -i ~/.ssh/id_rsa.pub root@bd02
ssh-copy-id -i ~/.ssh/id_rsa.pub root@bd03

关闭及禁止防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

关闭SELinux

# /etc/sysconfig/selinux
#修改以下内容
SELINUX=disabled

开启ntp服务

yum install -y ntp
systemctl enable ntpd
systemctl sgtart ntpd

安装jdk

此步骤省略

Ambari安装

准备软件包,下载到/var/www/html/ambari/,并解压

wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari-2.6.2.0-centos7.tar.gz
wget http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/HDP-2.6.5.0-centos7-rpm.tar.gz
wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz
wget http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/HDP-GPL-2.6.5.0-centos7-gpl.tar.gz

配置Ambari,HDP,HDP-UTILS本地源

下载仓库文件

cd /etc/yum.repos.d/
wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari.repo
wget http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/hdp.repo
wget http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/hdp.gpl.repo

修改仓库文件

  • ambari.repo
#VERSION_NUMBER=2.6.2.0-155
[ambari-2.6.2.0]
name=ambari Version - ambari-2.6.2.0
#baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0
baseurl=http://192.168.111.65/ambari/ambari/centos7/2.6.2.0-155
gpgcheck=1
#gpgkey=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
gpgkey=http://192.168.111.65/ambari/ambari/centos7/2.6.2.0-155/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
  • hdp.repo
#VERSION_NUMBER=2.6.5.0-292
[HDP-2.6.5.0]
name=HDP Version - HDP-2.6.5.0
#baseurl=http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0
baseurl=http://192.168.111.65/ambari/HDP/centos7/2.6.5.0-292
gpgcheck=1
#gpgkey=http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
gpgkey=http://192.168.111.65/ambari/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://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7
baseurl=http://192.168.111.65/ambari/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
#gpgkey=http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
gpgkey=http://192.168.111.65/ambari/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
  • hdp.gpl.repo
#VERSION_NUMBER=2.6.5.0-292
[HDP-GPL-2.6.5.0]
name=HDP-GPL Version - HDP-GPL-2.6.5.0
#baseurl=http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0
baseurl=http://192.168.111.65/ambari/HDP-GPL/centos7/2.6.5.0-292
gpgcheck=1
#gpgkey=http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
gpgkey=http://192.168.111.65/ambari/HDP-GPL/centos7/2.6.5.0-292/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

分配到另外两台机器

scp ambari.repo hdp.repo hdp.gpl.repo bd02:/etc/yum.repos.d/
scp ambari.repo hdp.repo hdp.gpl.repo bd03:/etc/yum.repos.d/

更新每台机器的yum缓存

yum clean all && yum makecache

安装Mysql

yum 安装mysql
wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
yum -y localinstall mysql80-community-release-el7-3.noarch.rpm
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
yum -y install mysql-community-server
systemctl start mysqld
systemctl enable mysqld

修改mysql root用户密码

grep 'temporary password' /var/log/mysqld.log   #查找自动生成的密码
mysql -uroot -p     #登录mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';   #修改root密码

创建ambari数据库及用户

# ambari
create database ambari character set utf8 ;
CREATE USER 'ambari'@'%'IDENTIFIED BY 'MyNewPass4!';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';

# Hive
create database hive character set utf8 ;  
CREATE USER 'hive'@'%'IDENTIFIED BY 'MyNewPass4!';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';

# Oozie
create database oozie character set utf8 ;  
CREATE USER 'oozie'@'%'IDENTIFIED BY 'MyNewPass4!';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';

安装ambari-server

yum -y install ambari-server

下载mysql驱动

  1. 下载驱动
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.40/mysql-connector-java-5.1.40.jar

如果需要其它版本,从下面链接下载

https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.40 2. 将mysql-connector-Java.jar复制到/usr/share/java目录下

mkdir /usr/share/java
cp mysql-connector-java-5.1.40.jar /usr/share/java/mysql-connector-java.jar
  1. 将mysql-connector-java.jar复制到/var/lib/ambari-server/resources目录下
cp mysql-connector-java-5.1.40.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar

Ambari初始化

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar 
ambari-server setup

setup的过程

[root@ambari-65 java]# 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)? ^C
Aborting ... Keyboard Interrupt.
[root@ambari-65 java]# 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)? y
Enter user account for ambari-server daemon (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] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1): 3
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: /srv/jdk/
Validating JDK on Ambari Server...done.
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):
Enter Database Password (bigdata):
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)? y
Extracting system views...
ambari-admin-2.6.2.0.155.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

说明: 1:提示是否自定义设置。输入:y 或 按回车继续 2:ambari-server 账号。使用root(推荐)用户直接回车 若使用ambari用户输入:ambari 3:设置JDK,输入数字3,选客户端安装jdk,如果服务器可以访问外网,则可以选1,自动下载jdk1.8,默认下载的安装目录是/usr/java/default 4:如果上面选择3自定义JDK,则需要设置JAVA_HOME 5:输入:y 或 按回车继续 6:输入“y“,进行数据库的高级配置 7:输入“3“,选择mysql/mariadb数据库 8:设置数据库的配置参数:host,port,database,username,password。根据实际情况输入,如果和括号内相同,则可以直接回车。若端口改6033则输入port:6033。 9:输入:y 或 按回车继续 (若设置更改,可以再次执行ambari-server setup进行设置) 10: 如果要修改连接mysql密码,请修改如下文件/etc/ambari-server/conf/password.dat

将Ambari数据库初始数据导入mysql

mysql > use ambari;
mysql > source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;

启动Ambari

ambari-server start

如下表示启动成功

[root@ambari-65 conf]# 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.

浏览器访问:http://192.168.111.65:8080/ 默认登录用户:admin,密码:admin

安装时遇到的问题

SSLError: Failed to connect. Please check openssl library versions

ERROR 2020-11-03 19:30:17,841 NetUtil.py:96 - EOF occurred in violation of protocol (_ssl.c:579)
ERROR 2020-11-03 19:30:17,841 NetUtil.py:97 - SSLError: Failed to connect. Please check openssl library versions. 
Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1022468 for more details.

解决方式: 修改配置文件(/etc/ambari-agent/conf/ambari-agent.ini),在security模块添加如下配置,然后重启ambari-agent

[security]
force_https_protocol=PROTOCOL_TLSv1_2