Configuring MySQL for Ranger
Prepare the environment by configuring MySQL to be used for Ranger.
Procedure
-
Create a non-root user to create the Ranger databases.
In this example, the username rangerdba with password rangerdba is used.
- Log in as the root user to the DB host node. Ensure that the DB is running. This is the node
that has MySQL installed, which is usually the Hive server node. Use the following commands to
create the rangerdba user, and grant the user 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;After setting the privileges, use the exit command to exit MySQL.
- Reconnect to the database as user rangerdba by using the following
command:
mysql -u rangerdba -prangerdba
After testing the rangerdba login, use the exit command to exit MySQL.
- Log in as the root user to the DB host node. Ensure that the DB is running. This is the node
that has MySQL installed, which is usually the Hive server node. Use the following commands to
create the rangerdba user, and grant the user adequate
privileges:
-
Check MySQL Java™ connector.
- Run 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 Ambari server node.
ls /usr/share/java/mysql-connector-java.jarNote: If the /usr/share/java/mysql-connector-java.jar is not found, install the mysql-connector-java package on the ambari-server node$ yum install mysql-connector-java - Use the following command to set the jdbc/driver/path based on the location
of the MySQL JDBC driver .jar file. This command must be run on the Ambari server
node.
ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}For example:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
- Run 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 Ambari server node.