1.2. Using Ambari with MySQL/MariaDB
To set up MySQL for use with Ambari:
On the Ambari Server host, install the connector.
Install the connector
RHEL/CentOS/Oracle Linux
yum install mysql-connector-java
SLES
zypper install mysql-connector-java
Ubuntu
apt-get install mysql-connector-java
Debian
apt-get install mysql-connector-java
Confirm that
.jar
is in the Java share directory.ls /usr/share/java/mysql-connector-java.jar
Make sure the .jar file has the appropriate permissions - 644.
Create a user for Ambari and grant it permissions.
For example, using the MySQL database admin utility:
# mysql -u root -p
CREATE USER '<AMBARIUSER>'@'%' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'%';
CREATE USER '<AMBARIUSER>'@'localhost' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'localhost';
CREATE USER '<AMBARIUSER>'@'<AMBARISERVERFQDN>' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'<AMBARISERVERFQDN>';
FLUSH PRIVILEGES;
Where
<AMBARIUSER>
is the Ambari user name,<AMBARIPASSWORD>
is the Ambari user password and<AMBARISERVERFQDN>
is the Fully Qualified Domain Name of the Ambari Server host.
Load the Ambari Server database schema.
You must pre-load the Ambari database schema into your MySQL/MariaDB database using the schema script.
mysql -u <AMBARIUSER> -p
CREATE DATABASE
<AMBARIDATABASE>
;
USE <AMBARIDATABASE>;
SOURCE Ambari-DDL-MySQL-CREATE.sql;
Where <AMBARIUSER> is the Ambari user name and <AMBARIDATABASE> is the Ambari database name.
Find the
Ambari-DDL-MySQL-CREATE.sql
file in the/var/lib/ambari-server/resources/
directory of the Ambari Server host after you have installed Ambari Server.
When setting up the Ambari Server, select
Advanced Database Configuration > Option [3] MySQL/MariaDB
and enter the credentials you defined in Step 2. for user name, password and database name.