Administering Ambari
Also available as:
PDF
loading table of contents...

Using Ambari with MySQL or MariaDB

Before setting up Ambari Sever with an existing, MySQL or Maria DB database; obtain the appropriate connectors and .jar files, create an Ambari user with sufficient permissions, and load the Ambari database schema.

Determine the appropriate database version and obtain the release drivers and .jar file.
  1. On the Ambari Server host, stage the appropriate connector/JDBC driver file for later deployment.
    1. On the Ambari Server host, Download the MySQL Connector/JDBC driver from MySQL
    2. Run ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar
    3. Confirm that .jar is in the Java share directory.
      ls /usr/share/java/mysql-connector-java.jar
    4. Make sure the .jar file has the appropriate permissions - 644.
  2. Create a user for Ambari and grant it permissions.
    using the MySQL database admin utility:
     # mysql -u root -p 
    CREATE USER '[AMBARI_USER]'@'%' IDENTIFIED BY '[AMBARI_PASSWORD]';
    GRANT ALL PRIVILEGES ON *.* TO '[AMBARI_USER]'@'%';
    CREATE USER '[AMBARI_USER]'@'localhost' IDENTIFIED BY '[AMBARI_PASSWORD]';
    GRANT ALL PRIVILEGES ON *.* TO '[AMBARI_USER]'@'localhost';
    CREATE USER '[AMBARI_USER]'@'[AMBARI_SERVER_FQDN]' IDENTIFIED BY '[AMBARI_PASSWORD]';
    GRANT ALL PRIVILEGES ON *.* TO '[AMBARI_USER]'@'[AMBARI_SERVER_FQDN]';
    FLUSH PRIVILEGES;
    Where [AMBARI_USER] is the Ambari user name, [AMBARI_PASSWORD] is the Ambari user password and [AMBARI_SERVER_FQDN] is the Fully Qualified Domain Name of the Ambari Server host.
  3. 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 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.

    mysql -u [AMBARI_USER] -p
    CREATE DATABASE [AMBARI_DATABASE];
    USE [AMBARI_DATABASE];
    SOURCE Ambari-DDL-MySQL-CREATE.sql;

    Where [AMBARI_USER] is the Ambari user name and [AMBARI_DATABASE] 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.