Ambari学习笔记-安装Ambari2.6.2

1 安装前准备

1.1 主机列表

本次实验选择4台主机,1台作为Ambari Server主机,3台作为Ambari Agent

节点ip OS版本 jdk版本 hostname -f 安装软件
192.168.0.1 RHEL7.4 jdk1.8.0_172 DEV000001 Ambari Server
192.168.0.2 RHEL7.4 jdk1.8.0_172 DEV000002 Ambari Agent
192.168.0.3 RHEL7.4 jdk1.8.0_172 DEV000003 Ambari Agent
192.168.0.4 RHEL7.4 jdk1.8.0_172 DEV000004 Ambari Agent

注意

  • Ambari Server主机到Ambari Agent主机免密登录
  • Ambari Server/Agent主机需安装JDK
  • 确保主机的hostname -f 满足FQDN格式(在安装集群的第三步Confirm Host需要)
  • 关闭防火墙
  • 确认主机字符集编码为UTF-8(否则Ambari Server 配置数据库可能报错)
  • 开启NTP服务

1.2 安装基本软件包

在所有的主机上安装

yum install openssh wget vim openssh-clients openssl openssh-server -y
systemctl enable sshd
systemctl start sshd

配置Ambari Server如果不使用默认的PostgreSQL数据库,使用Mysql/MariaDB,则需要单独安装

yum install mysql-connector-odbc mysql-connector-java -y 

1.3 配置本地yum源

1.3.1 下载安装介质

Ambari:http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari-2.6.2.0-centos7.tar.gz 

HDP2.6.5:http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/HDP-2.6.5.0-centos7-rpm.tar.gz 

HDP-UTILS1.1.0.21:http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz

注意

  • 到hortonworks官网查看HDP对应的Hadoop和Spark版本,选择正确的版本进行下载
  • 安装介质较大

1.3.2 配置HTTP yum源

因Ambari安装集群界面不能识别ftp地址,因此配置成http yum源。在10.124.142.193上安装httpd服务:

yum -y install httpd systemctl start httpd systemctl enable httpd 

将上一步下载的压缩包解压之后,放到/var/www/html下

通过浏览器访问http://192.168.0.1:18080/ambari/centos7/测试http yum源是否正常。

修改解压目录下里的ambari.repo、hdp.repo baseurl地址为http yum源地址。

ambari.repo

#VERSION_NUMBER=2.6.2.0-155
[ambari-2.6.2.0]
name=ambari Version - ambari-2.6.2.0
baseurl=http://192.168.0.1:18080/ambari/centos7/2.6.2.0-155/
gpgcheck=1
gpgkey=http://192.168.0.1:18080/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://10.124.142.193:18080/HDP-2.6.5.0/centos7/2.6.5.0-292/
gpgcheck=1
gpgkey=http://10.124.142.193:18080/HDP-2.6.5.0/centos7/2.6.5.0-292/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

[HDP-UTILS-1.1.0.21]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.21
baseurl=http://10.124.142.193:18080/HDP-UTILS-1.1.0.21/
gpgcheck=1
gpgkey=http://10.124.142.193:18080/HDP-UTILS-1.1.0.21/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

将ambari.repo、hdp.repo拷贝至192.168.0.1,192.168.0.2,192.168.0.3,192.168.0.4的/etc/yum.repos.d目录下。

2 安装Ambari Server

2.1 以默认方式安装Ambari Server

yum install -y ambari-server 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):root
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[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: /usr/java/jdk1.8.0_172-amd64
Validating JDK on Ambari Server...done.
Checking GPL software agreement...
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 (3): 1 ####如果主机字符集编码未设置正确,可能会启动报错,具体可以查看日志/var/log/ambari-server/ambari-server.log
Database admin user (postgres): postgres
Database name (ambari): ambari
Postgres schema (ambari): ambari
Username (ambari): ambari
Enter Database Password (bigdata):
Default properties detected.
Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take up to a minute.
About to start PostgreSQL Configuring local database...
Configuring PostgreSQL...
Backup for pg_hba found, reconfiguration not required Creating schema and user... done.
Creating tables... done.
Extracting system views...
............
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully. 
ambari-server start 

通过浏览器访问http://192.168.0.1:8080测试是否正常启动,默认用户名密码为admin/admin。

如果操作系统使用中文语言环境,在初始化postgre数据库时会因为脚本仅支持UTF8而初始化失败

解决办法:
cat /var/lib/pgsql/initdb.log
rm -rf /var/lib/pgsql/data/pg_log
postgresql-setup initdb
重新运行ambari-server setup 配置即可

2.2 以MariaDB为数据库安装Ambari Server

2.2.1 安装MariaDB

在192.168.0.1主机上安装MariaDB

只有3台主机,不能安装远程Mysql数据库,若安装Mysql在集群内,后续安装软件包会有冲突,因此使用MariaDB替换Mysql

修改root密码,并创建用户、数据库及表

UPDATE user SET password=PASSWORD('root123') WHERE user='root';
flush privileges;
exit;
##### ambari
create database ambari character set utf8 ;
CREATE USER 'ambari'@'%'IDENTIFIED BY 'bigdata';
grant all privileges on *.* to ambari@'localhost' identified by 'bigdata';
FLUSH PRIVILEGES;
##### hive
create database hive character set utf8 ;
CREATE USER 'hive'@'%'IDENTIFIED BY 'bigdata';
grant all privileges on *.* to hive@'localhost' identified by 'bigdata';
FLUSH PRIVILEGES;
##### create tables
mysql -uambari -pbigdata ambari < /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

安装配置Ambari Server

yum install -y ambari-server
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):root

Adjusting ambari-server permissions and ownership...

Checking firewall status...

Checking JDK...

Do you want to change Oracle JDK [y/n] (n)? y

[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: /usr/java/jdk1.8.0_172-amd64

Validating JDK on Ambari Server...done.

Checking GPL software agreement...

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): localhost

Port (3306): 3306

Database name (ambari): ambari

Username (ambari): 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...

............

Adjusting ambari-server permissions and ownership...

Ambari Server 'setup' completed successfully.

配置Ambari Server ,新增配置

server.jdbc.driver.path=/usr/share/java/mysql-connector.jar

ambari-server start

通过浏览器访问http://192.168.0.1:8080测试是否正常启动,默认用户名密码为admin/admin。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章