Before deploying an
Ambari-managed cluster, set up a secure MariaDB database and db users for each component with
sufficient permissions.
Determine the appropriate database version and obtain the
release drivers and .jar file.
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.-
On a dedicated host, Download the MySQL Connector/JDBC driver from
MySQL.
-
Install mysql packages and configure to start on boot.
yum install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
-
Secure the installation.
/usr/bin/mysql_secure_installation
-
Precreate 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]';
create database superset DEFAULT CHARACTER SET utf8;;
grant all privileges on superset.* to 'superset'@'localhost' identified by '[YOUR_PASSWORD]';
grant all privileges on superset.* to 'superset'@'%.[YOUR_DOMAIN_NAME]' identified by '[YOUR_PASSWORD]';
create database druid DEFAULT CHARACTER SET utf8;;
grant all privileges on druid.* to 'druid'@'localhost' identified by '[YOUR_PASSWORD]';
grant all privileges on druid.* to 'druid'@'%.[YOUR_DOMAIN_NAME]' identified by '[YOUR_PASSWORD]';
exit;
-
Install driver on ambari host.
yum install mysql-connector-java -y
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar