Ambari學習筆記-安裝Ambari2.6 on Mariadb/Mysql

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

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://192.168.0.1:18080/HDP-2.6.5.0/centos7/2.6.5.0-292/
gpgcheck=1
gpgkey=http://192.168.0.1: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://192.168.0.1:18080/HDP-UTILS-1.1.0.21/
gpgcheck=1
gpgkey=http://192.168.0.1: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 on Mariadb/Mysql

2.1安裝Mariadb/Mysql

yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb

2.2 配置Mariadb/Mysql

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

2.3 Mariadb/Mysql建庫建用戶

# mysql -uroot -p
Enter password: 

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database ambari character set utf8 ;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> CREATE USER 'ambari'@'%'IDENTIFIED BY 'bigdata';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on *.* to ambari@'%' identified by 'bigdata';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database hive character set utf8 ;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE USER 'hive'@'%'IDENTIFIED BY 'bigdata';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on *.* to hive@'%' identified by 'bigdata';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit
Bye

2.4 安裝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.

2.4 初始化Mariadb/Mysql

mysql -uambari -pbigdata ambari < /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

2.5 安裝Mariadb/Mysql驅動

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

 2.6 配置Mariadb/Mysql驅動

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

  2.7 啓動ambari-server

# 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.0.1:8080測試是否正常啓動,默認用戶名密碼爲admin/admin。

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