Prerequisites

When using MySQL, the storage engine used for the Ranger admin policy store tables MUST support transactions. InnoDB is an example of engine that supports transactions. A storage engine that does not support transactions is not suitable as a policy store.

Steps

If you are using Amazon RDS, see the Amazon RDS Requirements.

  1. The MySQL database administrator should be used to create the Ranger databases.

    The following series of commands could be used to create the rangerdba user with password rangerdba.

    a. Log in as the root user, then use the following commands to create the rangerdba user and grant it adequate privileges.

    1. CREATE USER 'rangerdba'@'localhost' IDENTIFIED BY 'rangerdba';
    2. GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'localhost';
    3. CREATE USER 'rangerdba'@'%' IDENTIFIED BY 'rangerdba';
    4. GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'%';
    5. GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'localhost' WITH GRANT OPTION;
    6. GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'%' WITH GRANT OPTION;
    7. FLUSH PRIVILEGES;

    b. Use the exit command to exit MySQL.

    c. You should now be able to reconnect to the database as rangerdba using the following command:

    1. mysql -u rangerdba -prangerdba

    After testing the rangerdba login, use the exit command to exit MySQL.

  2. Use the following command to confirm that the mysql-connector-java.jar file is in the Java share directory. This command must be run on the server where Ambari server is installed.

    1. ls /usr/share/java/mysql-connector-java.jar

    If the file is not in the Java share directory, use the following command to install the MySQL connector .jar file.

    RHEL/CentOS/Oracle/Aamazon Linux

    1. yum install mysql-connector-java*

    SLES

    1. zypper install mysql-connector-java*
  3. Use the following command format to set the jdbc/driver/path based on the location of the MySQL JDBC driver .jar file.This command must be run on the server where Ambari server is installed.

    1. ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}

    For example:

    1. ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar