Hive: Enable mysql metastore

Install Mysql database

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7

Create new user and grant permissions

https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql


Keep the mysqld service running on boot

$ systemctl enable mysqld


Crceate user account for hive in mysql. Login to mysql with root permission.

$ mysql -u root -p

<enter root passwowrd at the prompt>


CREATE USER 'hive'@'localhost' IDENTIFIED BY 'Mapr@123';

CREATE USER 'hive'@'%' IDENTIFIED BY 'Mapr@123';

GRANT ALL PRIVILEGES ON * . * TO 'hive'@'localhost';

GRANT ALL PRIVILEGES ON * . * TO 'hive'@'%';


Update hive-site.xml file with the following property. In MapR sandbox (v6), the file can be found in /opt/mapr/hive/hive-2.1/conf/hive-site.xml


...

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>

<description>JDBC connect string for a JDBC metastore</description>

</property>

<property>

<name>javax.jdo.option.ConnectionDriverName</name>

<value>com.mysql.jdbc.Driver</value>

<description>Driver class name for a JDBC metastore</description>

</property>

<property>

<name>javax.jdo.option.ConnectionUserName</name>

<value>hive</value>

<description>username to use against metastore database</description>

</property>

<property>

<name>javax.jdo.option.ConnectionPassword</name>

<value>Mapr@123</value>

<description>password to use against metastore database</description>

</property>

...

Restart the Hive Meta Store Service and Hive2 services.


Side note:

Extend the root LVM size on the VM.

https://community.mapr.com/docs/DOC-1608-how-to-extend-the-mapr-sandbox-vms-storage-space

Shutdown the VM, go to Settings > Storage > Controller

Click on the icon for "Add Hard Disk".

Select the size 51GB.

Start the VM and the run the following commands using root login.

fdisk -l | grep /dev

pvcreate /dev/sdb

vgextend vg_maprdemo /dev/sdb

vgdisplay vg_maprdemo | grep "Free"

lvextend -L+50G /dev/vg_maprdemo/lv_root

resize2fs /dev/vg_maprdemo/lv_root

df -h