Installing Apache Ranger
Also available as:
PDF

Configure a Ranger DB: MySQL/MariaDB

How to configure your MySQL database instance for Ranger.

A MySQL/Oracle/PostgreSQL/Amazon RDS database instance must be running and available to be used by Ranger.

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.

If you are using Amazon RDS, see “Configure an Amazon RDS Database Instance for Ranger: Prerequisites”.

  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.
    1. Log in as the root user, then use the following commands to create the rangerdba user and grant it adequate privileges.
      CREATE USER 'rangerdba'@'localhost' IDENTIFIED BY 'rangerdba';
      
      GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'localhost';
      
      CREATE USER 'rangerdba'@'%' IDENTIFIED BY 'rangerdba';
      
      GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'%';
      
      GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'localhost' WITH GRANT OPTION;
      
      GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'%' WITH GRANT OPTION;
      
      FLUSH PRIVILEGES;
  2. Use the exit command to exit MySQL.
  3. You should now be able to reconnect to the database as rangerdba using the following command: mysql -u rangerdba -prangerdba.
  4. After testing the rangerdba login, use the exit command to exit MySQL.
  5. 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: 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 Linux: yum install mysql-connector-java*
    • SLES: zypper install mysql-connector-java*
  6. 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: ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}.
    ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
“Start the Ranger Installation”