Thursday, June 9, 2016

MapR-Hue and MySql Integration


Requisites are:
OS-CentOS-6.6/Redhat-6.7
MapR-5.1
Hue-3.9
MySql

Steps:
Here Hue and MySql is installed on different nodes.
MySql Host:Host1
MapR-Hue Host:Host2

On Host1 Host, do below steps: Confirm before going to install it using rpm -qa command.
Step 1:
>rpm -qa | grep mysql-devel
If not installed , do below execution.
>yum install mysql-devel

Step 2:
rpm -qa | grep mysql-connector-java
If not installed , do below execution.
>yum install mysql-connector-java

Step 3:
> rpm -qa | grep mysql-server
If not installed , do below execution
>yum install mysql-server

Step 4:Change the /etc/my.cnf file as follows:
>vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
bind-address=Host1
#This IP is MySql installed Host.
default-storage-engine=InnoDB
sql_mode=STRICT_ALL_TABLES

Step 5:
Start the mysql daemon.
$ sudo service mysqld start

Step 6:
Configure the Mysql with password, initially MySql pwd could be not set, please set here with pwd.
>/usr/bin/mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on...
[...]
Set root password? [Y/n] y
New password:x
Re-enter new password:x
Remove anonymous users? [Y/n] Y
[...]
Disallow root login remotely? [Y/n] N
[...]
Remove test database and access to it [Y/n] Y
[...]
Reload privilege tables now? [Y/n] Y
All done!
(#Here I have provided password as “ x ”)
Step 7:
>mysql> drop database hue;
Create a database for Hue with name “hue” in mysql by using below command.
mysql> create database hue;
Query OK, 1 row affected (0.00 sec)

Here the Host Host2 is the HUE installation HostName.
mysql> grant all on hue.* to 'hue'@Host2 identified by 'x';
Query OK, 0 rows affected (0.00 sec)
# here 'x' is the mysql password

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)







Step 8:
In Hue installed Host Host2, Edit the hue.ini file with this information.
> vi /opt/mapr/hue/hue-3.9.0/desktop/conf/hue.ini

[[database]]
host=Host1
port=3306
engine=mysql
user=hue
password=x
name=hue

Add the below details under “# Settings for the RDBMS application “
> vi /opt/mapr/hue/hue-3.9.0/desktop/conf/hue.ini

[librdbms]

[[databases]]
#Add at MySql settings area.
host=Host1
port=3306
engine=mysql
user=hue
password=x
name=hue

Step 9:
Do these steps in Hue installation Host i.e. Host2
>/opt/mapr/hue/hue-3.9.0/build/env/bin/hue dumpdata > bkpHueData.json
Delete the data in the file in “model “ field if any thing with "useradmin.userprofile" , remove that json file and save it.
Check if any words are presenting with "useradmin.userprofile" string in backup file.
>cat bkpHueData.json | grep useradmin.userprofile

Step 10:
Restart the Hue serverice
> maprcli node services -name hue -action restart -nodes `hostname`

Syncdb operation:
/opt/mapr/hue/hue-3.9.0/build/env/bin/hue syncdb --noinput

Migrating the hue.
/opt/mapr/hue/hue-3.9.0/build/env/bin/hue migrate
From Host1 Mysql Installed Host execute this command.

Step 11:
From MySql Host do the below operation:
mysql> DELETE FROM hue.django_content_type;

Step 12:
From Host2, Hue installed host do this command.
> /opt/mapr/hue/hue-3.9.0/build/env/bin/hue loaddata bkpHueData.json

Start the Hue UI using the Url.
:8888 ” at url browser.

Try to add a user to “ AddUser “ are at mapr user and add it and check the updated table info at mysql using below command/.
mysql> select *from auth_user;
(It ll display the recently added user info in this table.)


No comments:

Post a Comment