Using Ambari with MySQL/MariaDB
To set up MySQL/MariaDB for use with Ambari:
Steps
On the Ambari Server host:
On the Ambari Server host run:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar
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. Run the script in the same location where you find the
Ambari-DDL-MySQL-CREATE.sql
file. You should find theAmbari-DDL-MySQL-CREATE.sql
file in the/var/lib/ambari-server/resources/
directory of the Ambari Server host, after you have installed Ambari Server.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.
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.