Apache Ambari Administration
Also available as:
PDF
loading table of contents...

Using Hive with MySQL/MariaDB

To set up MySQL/MariaDB for use with Hive:

Steps

  1. On the Ambari Server host, stage the appropriate MySQL connector for later deployment.

    1. Download the MySQL Connector/JDBC driver from MySQL.

    2. Make sure the .jar file has the appropriate permissions for Ambari to access it - 644.

    3. On the Ambari Server host run:

      ambari-server setup --jdbc-db=mysql --jdbc-driver=<path to mysql connector jar>
  2. Create a user for Hive and grant it permissions.

    • Using the MySQL database admin utility:

       # mysql -u root -p
      CREATE USER '<HIVEUSER>'@'localhost' IDENTIFIED BY '<HIVEPASSWORD>';
      GRANT ALL PRIVILEGES ON *.* TO '<HIVEUSER>'@'localhost';
      CREATE USER '<HIVEUSER>'@'%' IDENTIFIED BY '<HIVEPASSWORD>';
      GRANT ALL PRIVILEGES ON *.* TO '<HIVEUSER>'@'%';
      CREATE USER '<HIVEUSER>'@'<HIVEMETASTOREFQDN>' IDENTIFIED BY '<HIVEPASSWORD>';
      GRANT ALL PRIVILEGES ON *.* TO '<HIVEUSER>'@'<HIVEMETASTOREFQDN>';
      FLUSH PRIVILEGES;
    • Where <HIVEUSER> is the Hive user name, <HIVEPASSWORD> is the Hive user password and <HIVEMETASTOREFQDN> is the Fully Qualified Domain Name of the Hive Metastore host.

  3. Create the Hive database.

    The Hive database, named hive for example, must be created before loading the Hive database schema.

    # mysql -u root -p
    CREATE DATABASE hive