Acceldata
ODP

Using an Existing or Installing a Default Database

Using an Existing Database with Ambari

Other than the embedded PostgreSQL database instance that Ambari Server uses by default.

Before using Ambari with an existing database, consider:

Using the Microsoft SQL Server or SQL Anywhere database options are not supported.

Using Ambari with Oracle

Before setting up Ambari Sever with an existing Oracle database; obtain the appropriate drivers and .jar files, create an Ambari user with sufficient permissions, and load the Ambari database schema.

Before you begin

Determine the appropriate Oracle database version and obtain the release drivers and .jar file.

Procedure

  1. On the Ambari Server host, stage the appropriate JDBC driver file for later deployment. a) Download the Oracle JDBC (OJDBC) driver from [this link](%5Bhttps://www.oracle.com/technetwork/database/application-%5D(https://www.oracle.com/technetwork/database/application-) development/jdbc/downloads/index.html.). b) Copy the .jar file to the Java share directory. cp ojdbc7.jar /usr/share/java/ c) Make sure the .jar file has the appropriate permissions. chmod 644 /usr/share/java/ojdbc7.jar
  2. Create a user for Ambari and grant that user appropriate permissions. using the Oracle database admin utility, run the following commands:
- sqlplus sys/root as sysdba
CREATE USER [AMBARI_USER] IDENTIFIED BY [AMBARI_PASSWORD] default
tablespace "USERS" temporary tablespace "TEMP";
GRANT unlimited tablespace to [AMBARI_USER];
GRANT create session to [AMBARI_USER];
GRANT create TABLE to [AMBARI_USER];
GRANT create SEQUENCE to [AMBARI_USER];
QUIT;
Where [AMBARI_USER] is the Ambari user name and [AMBARI_PASSWORD] is the Ambari user password.
  1. Load the Ambari Server database schema.

a) You must pre-load the Ambari database schema into your Oracle database using the schema script. sqlplus [AMBARI_USER]/[AMBARI_PASSWORD] Ambari-DDL-Oracle-CREATE.sql

b) Find the Ambari-DDL-Oracle-CREATE.sql file in the /var/lib/ambari-server/resources/ directory of the Ambari Server host after you have installed Ambari Server.

What to do next

When setting up the Ambari Server, select Advanced Database Configuration ] Option [2] Oracle and respond to the prompts using the username/password credentials you created in step 2.

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.

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

Info

Here is a sample setup guide for MySQL 5.7.x and 8.x databases and respective connector jar.

For CentOS :

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum install mysql-community-server
sudo yum install mysql-connector-java*
systemctl start mysqld

For Ubuntu :

wget http://repo.mysql.com/mysql-apt-config_0.8.12-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
sudo dpkg-reconfigure mysql-apt-config
sudo apt update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
sudo apt update
sudo apt-cache policy mysql-server
sudo apt install -f mysql-client=5.7*
sudo apt install -f mysql-community-server=5.7*
sudo apt install -f mysql-server=5.7*
wget https://downloads.mysql.com/archives/get/p/3/file/mysql-connector-j_8.0.32-1ubuntu20.04_all.deb
sudo dpkg -i mysql-connector-j_8.0.32-1ubuntu20.04_all.deb
Confirm that binding-address in /etc/mysql/mysql.conf.d/mysqld.cnf points to right host IP. Remove 127.0.0.1 to the IP where your database is. Then restart mysql service mysql restart .
Procedure
  1. On the Ambari Server host, stage the appropriate connector/JDBC driver file for later deployment.

a) On the Ambari Server host, Download the MySQL Connector/JDBC driver from MySQL.

b) Run ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar

c) Confirm that .jar is in the Java share directory. For example: ls /usr/share/java/mysql- connector-java.jar

d) Make sure the .jar file has the appropriate permissions - 644.

  1. 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.

Info

For example, view the below code block for configuration with MariaDB 10.11:

Create database ambari;
CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'bigdata';
CREATE USER 'ambari'@'%' IDENTIFIED BY 'bigdata';
CREATE USER 'ambari'@'<hostname>' IDENTIFIED BY 'bigdata';
grant all privileges on *.* to 'ambari'@'localhost';
grant all privileges on *.* to 'ambari'@'%';
GRANT ALL PRIVILEGES ON ambari.* TO 'ambari'@'%' WITH GRANT OPTION;
grant all privileges on *.* to 'ambari'@'<hostname>';
FLUSH PRIVILEGES;
  1. 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 /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
SHOW TABLES;
Where [AMBARI_USER] is the Ambari user name and [AMBARI_DATABASE] is the Ambari database name.
What to do next
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.

Using Ambari with PostgreSQL

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

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

Procedure

  1. On the Ambari Server host, stage the appropriate JDBC driver file for later deployment.

a) On the Ambari server host, Download the PostgreSQL JDBC Driver from PostgreSQL.

b) Run ambari-server setup --jdbc-db=postgres --jdbc-driver=/path/to/postgres/postgresql.jar

  1. Create a user for Ambari and grant it permissions. Using the PostgreSQL database admin utility:
sudo -u postgres psql
CREATE DATABASE [AMBARI_DATABASE];
CREATE USER [AMBARI_USER] WITH PASSWORD '[AMBARI_PASSWORD]';
GRANT ALL PRIVILEGES ON DATABASE [AMBARI_DATABASE] TO [AMBARI_USER];
connect [AMBARI_DATABASE];
CREATE SCHEMA [AMBARI_SCHEMA] AUTHORIZATION [AMBARI_USER];
ALTER SCHEMA [AMBARI_SCHEMA] OWNER TO [AMBARI_USER];
ALTER ROLE [AMBARI_USER] SET search_path_to_'[AMBARI_SCHEMA]', 'public';
Where [AMBARI_USER_] is the_ Ambari user name __[AMBARI_PASSWORD] is the Ambari user password, [AMBARI_DATABASE] is the Ambari database name and [AMBARI_SCHEMA] is the Ambari schema name.

Info

For example view the below code block for configuration with postgreSQL 15.5:

CREATE DATABASE hive;
CREATE USER hive WITH ENCRYPTED PASSWORD 'Acceldata@01';
GRANT ALL PRIVILEGES ON DATABASE hive TO hive;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO hive;
GRANT ALL ON SCHEMA public TO hive;
GRANT CONNECT ON DATABASE hive TO hive;
ALTER USER hive CREATEDB;
ALTER USER hive CREATEROLE;

SELECT pg_reload_conf();

  1. Configure postgresql.conf & pg_hba.conf to allow access to other hosts:
vi /var/lib/pgsql/12/data/pg_hba.conf
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
local all ambari trust
host all ambari 0.0.0.0/0 trust
host all ambari ::/0 trust
local all hive trust
host all hive 0.0.0.0/0 trust
host all hive ::/0 trust
vi /var/lib/pgsql/15/data/postgresql.conf
listen_addresses = '*'
  1. Load the Ambari Server database schema.

You must pre-load the Ambari database schema into your PostgreSQL database using the schema script.

-psql -U [AMBARI_USER] -d [AMBARI_DATABASE]
connect [AMBARI_DATABASE];
i Ambari-DDL-Postgres-CREATE.sql;
Find the Ambari-DDL-Postgres-CREATE.sql file in the /var/lib/ambari-server/resources/ directory of the Ambari Server host after you have installed Ambari Server.
What to do next
When setting up the Ambari Server, select Advanced Database Configuration > Option[4] PostgreSQL and enter the credentials you defined in Step 2. for user name, password, and database name.

Using a New or Existing Database with Hive

Including the embedded MySQL database instance that Ambari installs and Hive uses by default. Before using Hive with a new or existing database, consider:

Using the Microsoft SQL Server or SQL Anywhere database options are not supported.

Using Hive with Oracle

Before using Hive with a new or existing Oracle database; obtain the appropriate driver and .jar files, and create a Hive user with sufficient permissions.

Before you begin

Determine the appropriate Oracle database version and obtain the release drivers and .jar file.

Procedure

  1. On the Ambari Server host, stage the appropriate JDBC driver file for later deployment.

a) Download the Oracle JDBC (OJDBC) driver from http://www.oracle.com/technetwork/database/features/jdbc/ index-091264.html.

b) Make sure the .jar file has the appropriate permissions. chmod 644 ojdbc6.jar

c) Add the path to the downloaded .jar file.

ambari-server setup --jdbc-db=oracle --jdbc-driver=/path/to/downloaded/ojdbc6.jar
  1. Create a user for Hive and grant it permissions. using the Oracle database admin utility:
sqlplus sys/root as sysdba
CREATE USER [HIVE_USER] IDENTIFIED BY [HIVE_PASSWORD]; GRANT SELECT_CATALOG_ROLE TO [HIVE_USER];
GRANT CONNECT, RESOURCE TO [HIVE_USER];
QUIT;
Where [HIVE_USER] is the Hive user name and [HIVE_PASSWORD] is the Hive user password.

Using Hive with MySQL

Before using Hive with a new or existing MySQL database; obtain the appropriate driver and .jar files, create a Hive

user with sufficient permissions, and load the Hive database.

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

Procedure

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

a) On the Ambari Server host, Download the MySQL Connector/JDBC driver from MySQL.

b) Runambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar

c) Confirm that mysql-connector-java.jar is in the Java share directory. ls /usr/share/java/mysql-connector-java.jar

d) Make sure the .jar file has the appropriate permissions - 644.

e) Execute the following command:

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
  1. Create a user for Hive and grant it permissions. using the MySQL database admin utility:
mysql -u root -p
CREATE USER '[HIVE_USER]'@'localhost' IDENTIFIED BY '[HIVE_PASSWORD]'; GRANT ALL PRIVILEGES ON *.* TO '[HIVE_USER]'@'localhost';
CREATE USER '[HIVE_USER]'@'%' IDENTIFIED BY '[HIVE_PASSWORD]';
GRANT ALL PRIVILEGES ON *.* TO '[HIVE_USER]'@'%';
CREATE USER '[HIVE_USER]'@'[HIVE_METASTORE_FQDN]' IDENTIFIED BY
'[HIVE_PASSWORD]';
GRANT ALL PRIVILEGES ON *.* TO '[HIVE_USER]'@'[HIVE_METASTORE_FQDN]';
FLUSH PRIVILEGES;
Where[HIVE_USER] is the Hive user name, [HIVE_PASSWORD] is the Hive user password and [HIVE_METASTORE_FQDN] is the Fully Qualified Domain Name of the Hive Metastore host.
  1. Create the Hive database.

The Hive database must be created before loading the Hive database schema.

- mysql -u root -p
CREATE DATABASE [HIVE_DATABASE]
Where [HIVE_DATABASE] is the Hive database name.

Using Hive with PostgreSQL

Before using Hive with a new or existing PostgrSQL database; obtain the appropriate driver and .jar files, and create a Hive user with sufficient permissions.

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

Procedure

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

a) On the Ambari Server host, Download the PostgreSQL JDBC Driver from PostgreSQL.

b) Confirm that .jar is in the Java share directory.

ls /usr/share/java/postgresql-jdbc.jar

c) Change the access mode of the .jar file to 644. chmod 644 /usr/share/java/postgresql- jdbc.jar

d) Execute the following command:

ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql-jdbc.jar

  1. Create a user for Hive and grant it permissions.

using the PostgreSQL database admin utility:

echo "CREATE DATABASE [HIVE_DATABASE];" | psql -U postgres
echo "CREATE USER [HIVE_USER] WITH PASSWORD '[HIVE_PASSWORD]';" | psql -U
postgres
echo "GRANT ALL PRIVILEGES ON DATABASE [HIVE_DATABASE] TO [HIVE_USER];" |
psql -U postgres
Where [HIVE_USER] is the Hive user name, [HIVE_PASSWORD] is the Hive user password and [HIVE_DATABASE] is the Hive database name.

Using a New or Existing Database with Ranger

Configuring MySQL for Ranger

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

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

The following series of commands could be used to create the rangerdbauser with passwordrangerdba.

a. 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;
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:
mysql -u rangerdba -prangerdba
After testing the rangerdba login, use the exit command to exit MySQL.
  1. 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.
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 7
yum install mysql-connector-java*
  1. 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.

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

Configuring PostgreSQL for Ranger

RHEL/CentOS 7

  1. Execute the following command.
yum install postgresql-jdbc*
  1. Confirm that the .jar file is in the Java share directory.
ls /usr/share/java/postgresql-jdbc.jar
  1. Change the access mode of the .jar file to 644.
chmod 644 /usr/share/java/postgresql-jdbc.jar
  1. The PostgreSQL database administrator should be used to create the Ranger databases. The following series of commands could be used to create the rangerdba user and grant it adequate privileges.
echo "CREATE DATABASE $dbname;" | sudo -u $postgres psql -U postgres echo "CREATE USER $rangerdba WITH PASSWORD '$passwd';" | sudo -u $postgres psql -U postgres
echo "GRANT ALL PRIVILEGES ON DATABASE $dbname TO $rangerdba;" | sudo -u $postgres psql -U postgres
Where:
• $postgres is the Postgres user.
• $dbname is the name of your PostgreSQL database
  1. Use the following command format to set the jdbc/driver/path based on the location of the PostgreSQL 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}
For example:
ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/ postgresql-jdbc.jar
  1. Run the following command:

export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${JAVA_JDBC_LIBS}:/connector jar path

  1. Add Allow Access details for Ranger users:
  • change listen_addresses='localhost' to listen_addresses='*' ('*' = any) to listen from all IPs in postgresql.conf.
  • Make the following changes to the Ranger db user and Ranger audit db user in the pg_hba.conf file.
  1. After editing the pg_hba.conf file, run the following command to refresh the PostgreSQL database configuration:
sudo -u postgres /usr/bin/pg_ctl -D $PGDATA reload
For example, if the pg_hba.conf file is located in the /var/lib/pgsql/data directory, the value of $PGDATA is /var/lib/pgsql/data.

Configuring Oracle for Ranger

  1. On the Oracle host, install the appropriate JDBC .jar file.
  • Download the Oracle JDBC (OJDBC) driver from Oracle site.
  • For Oracle Database 12c: select Oracle Database 12c Release 1 driver > ojdbc7.jar.
  • For Oracle Database 19c: select Oracle Database 19c JDBC Driver & UCP Downloads - Long Term Release > Oracle JDBC Driver > ojdbc8.jar.
  • Copy the .jar file to the Java share directory. For example:
cp ojdbc*.jar /usr/share/java/
Note
Make sure the .jar file has the appropriate permissions. For example: chmod 644 /usr/share/java/ojdbc*.jar
  1. The Oracle database administrator should be used to create the Ranger databases.

The following series of commands could be used to create the RANGERDBA user and grant it permissions using SQL*Plus, the Oracle database administration utility:

# sqlplus sys/root as sysdba CREATE USER $RANGERDBA IDENTIFIED BY $RANGERDBAPASSWORD;
GRANT SELECT_CATALOG_ROLE TO $RANGERDBA;
GRANT CONNECT, RESOURCE TO $RANGERDBA;
QUIT;
  1. Use the following command format to set the jdbc/driver/path based on the location of the Oracle 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}
For example:
ambari-server setup --jdbc-db=oracle --jdbc-driver=/usr/share/java/ojdbc6. jar

MySQL/MariaDB Prerequisites

You must change the variable log_bin_trust_function_creators to 1 during Ranger installation.

From RDS Dashboard>Parameter group (on the left side of the page):

  1. Set the MySQL Server variable log_bin_trust_function_creators to 1.
  2. (Optional) After Ranger installation is complete, reset

log_bin_trust_function_creators to its original setting. The variable is only required to be set to 1 during Ranger installation.

PostgreSQL Prerequisites

The Ranger database user in PostgreSQL Server should be created before installing Ranger and should be granted an existing role which must have the role CREATEDB.

  1. Using the master user account, log in to the PostgreSQL Server from the master user account (created during PostgreSQL instance creation) and execute the following commands:
CREATE USER $rangerdbuser WITH LOGIN PASSWORD 'password';
GRANT $rangerdbuser to $postgresroot;
Where $postgresroot is the PostgreSQL master user account (for example: postgresroot) and $rangerdbuser is the Ranger database user name (for example: rangeradmin).
  1. If you are using Ranger KMS, execute the following commands:
CREATE USER $rangerkmsuser WITH LOGIN PASSWORD 'password';
GRANT $rangerkmsuser to $postgresroot;
Where $postgresroot is the PostgreSQL master user account (for example: postgresroot) and $rangerkmsuser is the Ranger KMS user name (for example: rangerkms).

Oracle Prerequisites

  1. Log in to the Oracle Server from the master user account (created during Oracle instance creation) and execute following commands:
create user $rangerdbuser identified by password;
GRANT CREATE SESSION, CREATE PROCEDURE, CREATE TABLE, CREATE VIEW, CREATE SEQUENCE, CREATE PUBLIC SYNONYM,CREATE ANY SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO $rangerdbuser;
create tablespace $rangerdb datafile size 10M autoextend on;
alter user $rangerdbuser DEFAULT Tablespace $rangerdb;
Where $rangerdb is a actual Ranger database name (for example: ranger) and $rangerdbuser is Ranger database username (for example: rangeradmin).
  1. If you are using Ranger KMS, execute the following commands:
create user $rangerdbuser identified by password;
GRANT CREATE SESSION,CREATE PROCEDURE,CREATE TABLE,CREATE VIEW,CREATE SEQUENCE,CREATE PUBLIC SYNONYM,CREATE ANY SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO $rangerkmsuser;
create tablespace $rangerkmsdb datafile size 10M autoextend on;
alter user $rangerkmsuser DEFAULT Tablespace $rangerkmsdb;
Where $rangerkmsdb is a actual Ranger database name (for example: rangerkms) and $rangerkmsuser is Ranger database username (for example: rangerkms).

Using an Existing Database with Oozie

Before using Oozie with an existing database, consider:

Using the Microsoft SQL Server or SQL Anywhere database options are not supported.

Using Oozie with Oracle

Before using OOZIE with a new or existing Oracle database; obtain the appropriate driver and .jar files, and create a Hive user with sufficient permissions.

Before you begin

Determine the appropriate Oracle database version and obtain the release drivers and .jar file.

Procedure

  1. On the Ambari Server host, stage the appropriate JDBC driver file for later deployment.

a) Download the Oracle JDBC (OJDBC) driver from http://www.oracle.com/technetwork/database/features/jdbc/ index-091264.html.

b) Make sure the .jar file has the appropriate permissions. chmod 644 ojdbc7.jar

c) Add the path to the downloaded .jar file.

ambari-server setup --jdbc-db=oracle --jdbc-driver=/path/to/downloaded/ojdbc7.jar

  1. Create a user for OOZIE and grant it permissions. using the Oracle database admin utility:
sqlplus sys/root as sysdba
CREATE USER [OOZIE_USER] IDENTIFIED BY [OOZIE_PASSWORD];
GRANT ALL PRIVILEGES TO [OOZIE_USER];
GRANT CONNECT, RESOURCE TO [OOZIE_USER];
QUIT;
Where [OOZIE_USER] is the Oozie user name and [OOZIE_PASSWORD] is the Oozie user password.

Using Oozie with MySQL

Before using Oozie with a new or existing MySQL database; obtain the appropriate driver and .jar files, create a Oozie user with sufficient permissions, and create the Oozie database.

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

Procedure

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

a) On the Ambari Server host, Download the MySQL Connector/JDBC driver from MySQL.

b) Runambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar

c) Confirm that mysql-connector-java.jar is in the Java share directory. ls /usr/share/java/mysql-connector-java.jar

d) Make sure the .jar file has the appropriate permissions - 644.

e) Execute the following command:

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

  1. Create a user for Oozie and grant it permissions. using the MySQL database admin utility:
mysql -u root -p
CREATE USER '<OOZIEUSER>'@'%' IDENTIFIED BY '<OOZIEPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<OOZIEUSER>'@'%';
FLUSH PRIVILEGES;
Where [OOZIE_USER] is the Oozie user name and [OOZIE_PASSWORD] is the Oozie user password.
  1. Create the Oozie database.

The Oozie database must be created before loading the Oozie database schema.

mysql -u root -p
CREATE DATABASE [OOZIE_DATABASE]
Where [OOZIE_DATABASE] is the Oozie database name.

Using Oozie with PostgreSQL

Before using Oozie with a new or existing PostgrSQL database; obtain the appropriate driver and .jar files, and create a Oozie user with sufficient permissions.

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

Procedure

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

a) On the Ambari Server host, Download the PostgreSQL JDBC Driver from PostgreSQL.

b) Confirm that .jar is in the Java share directory. ls /usr/share/java/postgresql-jdbc.jar

c) Change the access mode of the .jar file to 644. chmod 644 /usr/share/java/postgresql- jdbc.jar

d) Execute the following command:

ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql-jdbc.jar
  1. Create a user for Oozie and grant it permissions. Using the PostgreSQL database admin utility:
echo "CREATE DATABASE [OOZIE_DATABASE];" | psql -U postgres
echo "CREATE USER [OOZIE_USER] WITH PASSWORD '[OOZIE_PASSWORD]';" | psql - U postgres
echo "GRANT ALL PRIVILEGES ON DATABASE [OOZIE_DATABASE] TO [OOZIE_USER];" | psql -U postgres
Where [OOZIE_USER] is the Oozie user name, [OOZIE_PASSWORD] is the Oozie user password and [OOZIE_DATABASE] is the Oozie database name.

Example: Install MariaDB for Use with Multiple Components

Before deploying an Ambari-managed cluster, set up a secure MariaDB database and db users for each component with sufficient permissions.

Before you begin

Determine the appropriate database version and obtain the release drivers and .jar file.

About this task

This example is specific for Centos/RHEL 7 OS systems. For production setups, please consider installing the database instance on a dedicated host and configuring master-slave replication.

Procedure

  1. On a dedicated host, Download the MySQL Connector/JDBC driver from MySQL.
  2. Install mysql packages and configure them to start on boot.
yum install mariadb-server -y
systemctl start mariadb systemctl enable mariadb
  1. Secure the installation. /usr/bin/mysql_secure_installation
  2. Pre-create databases and users.

% matches any host on your domain, so we add localhost explicitly

mysql -uroot -p
create database hive;
grant all privileges on hive.* to 'hive'@'localhost' identified by '[YOUR_PASSWORD]';
grant all privileges on hive.* to 'hive'@'%. [YOUR_DOMAIN_NAME]' identified by '[YOUR_PASSWORD]';
create database ranger;
grant all privileges on ranger.* to 'ranger'@'localhost' identified by '[YOUR_PASSWORD]';
grant all privileges on ranger.* to 'ranger'@'%. [YOUR_DOMAIN_NAME]' identified by '[YOUR_PASSWORD]';
create database rangerkms;
grant all privileges on rangerkms.* to rangerkms@'localhost' identified by '[YOUR_PASSWORD]';
grant all privileges on rangerkms.* to rangerkms@'%. [YOUR_DOMAIN_NAME]' identified by '[YOUR_PASSWORD]';
create database oozie;
grant all privileges on oozie.* to 'oozie'@'localhost' identified by '[YOUR_PASSWORD]';
grant all privileges on oozie.* to 'oozie'@'%. [YOUR_DOMAIN_NAME]' identified by '[YOUR_PASSWORD]';
exit;
  1. Install driver on Ambari host.
yum install mysql-connector-java -y
ambari-server setup --jdbc-db=mysql --jdbc-driver=</path/to/mysql-connector-java.jar>