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。

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