Ambari学习笔记-安装Ambari2.6 on Mariadb/Mysql

1 安装前准备

1.1 主机列表

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

节点ipOS版本jdk版本hostname -f安装软件
192.168.0.1RHEL7.4jdk1.8.0_172DEV000001Ambari Server
192.168.0.2RHEL7.4jdk1.8.0_172DEV000002Ambari Agent
192.168.0.3RHEL7.4jdk1.8.0_172DEV000003Ambari Agent
192.168.0.4RHEL7.4jdk1.8.0_172DEV000004Ambari 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。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

snipercai

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值