installing hive on ubuntu 16

17
Download and Install Apache Hive SINGLE NODE CLUSTER e n r i q u e . d a v i l a @ g m a i l . c o m 1 1 0 / 2 5 / 2 0 1 6

Upload: enrique-davila

Post on 06-Apr-2017

358 views

Category:

Data & Analytics


3 download

TRANSCRIPT

Page 1: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

1

Download and Install Apache HiveSINGLE NODE CLUSTER

10/25/2016

Page 2: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

2Please note

Hive depends of hadoop, you would need an existing cluster already installed and running

10/25/2016

Page 3: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

3Download hive from internet

In your home folder create a new folder: mkdir hive Then move into new folder, command below cd hive Then type: wget http://

www-us.apache.org/dist/hive/hive-2.0.1/apache-hive-2.0.1-bin.tar.gz

10/25/2016

Page 4: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

4Unzip or untar hive

Run command below to untar hive hadoop@hadoopdev:~/hadoop_install/hive$ tar zxvf apache-hive-

2.1.0-bin.tar.gz

Move into apache-hive-2.1.0-bin

10/25/2016

Page 5: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

5Point hive to our existing hadoop folder

Sudo gedit hive-env.sh.template Modify the hadoop_home variable to point to your existing

hadoop folder and save it and close it (the variable $HADOOP_INSTALL was configured on the previous slide)

10/25/2016

Page 6: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

6Rename hive-env.sh.template

You need to rename hive-env.sh.template to hive-env.sh, run the following command:

cp hive-env.sh.template hive-env.sh This will create new file called hive-env.sh

10/25/2016

Page 7: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

7Modify ~/.bashrc 10/25/2016

Modify ~/.bashrc You need to include 2 new variables: $HIVE_HOME, $PATH At the top will see the $HADOOP_INSTALL variable, previously

defined in the ppt Easy way to install Hadoop

Page 8: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

8Defining Metastore

Metastore is necessary part of hive It will store all the information such Metadata (tables, DML,

information related to the database) You can use any database, in this tutorial we will use MySQL

10/25/2016

Page 9: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

9Install MySQL

Run this command sudo apt-get install mysql-server Install MySQL Java library sudo apt-get install libmysql-java Create a soft link: ln -s /usr/share/java/mysql-connector-java.jar

$HIVE_HOME/lib/mysql-connector-java.jar

10/25/2016

Page 10: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

10Create a MySQL Database

#use the following steps to create a database #Mysql password was defined during the installation # its important to use absolute path (full path, no variables) when

#loading data using command SOURCE within MySQL mysql -u root -p Enter password: mysql> CREATE DATABASE metastore; mysql> USE metastore; mysql> SOURCE /home/hadoop/hadoop_install/hive/apache-hive-

2.1.0-bin/scripts/metastore/upgrade/mysql/hive-schema-0.14.0.mysql.sql;

10/25/2016

Page 11: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

11Create MySQL Hive User and remove admin privileges

mysql> CREATE USER 'hiveuser'@'%' IDENTIFIED BY 'hivepassword';

mysql> GRANT all on *.* to 'hiveuser'@localhost identified by 'hivepassword';

mysql> flush privileges; mysql> CREATE USER 'hiveuser'@'%' IDENTIFIED BY

'hivepassword'; mysql> GRANT all on *.* to 'hiveuser'@localhost identified by

'hivepassword'; mysql> flush privileges;

10/25/2016

Page 12: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

12Identifying Hive user and password

We defined the Mysql Hive User wich is: hiveuser We defined a Mysql Hive password for hiveuser which is:

hivepassword

10/25/2016

Page 13: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

13Create hive-site.xml

Create hive-site.xml in case this does not exist. Copy and past the code from the next slide:

10/25/2016

Page 14: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

14hive-site.xml10/25/2016

<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost/metastore?createDatabaseIfNotExist=true</value> <description>metadata is stored in a MySQL server</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>MySQL JDBC driver class</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hiveuser</value> <description>user name for connecting to mysql server</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hivepassword</value> <description>password for connecting to mysql server</description> </property></configuration>

Page 15: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

15Launch Hive

Run hadoop daemons: $ start-all.sh Then run hive $ hive Below hive shell (Create and describe table)

10/25/2016

Page 16: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

16Credits

Thanks to the site: http://saurzcode.in/2015/01/configure-mysql-metastore-hive/ This site includes the simplest way to install metastore hive

10/25/2016

Page 17: Installing hive on ubuntu 16

enrique.davila@gm

ail.com

17Questions

[email protected]

10/25/2016