Setup hive and test queries


Published on

This is basic tutorial to setup hive in rapid way and quickly test the hive shell with same statement.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Setup hive and test queries

  1. 1. Setup Hive and Collect the Honey By Kannan Kalidasan
  2. 2. Hive Introduction Hive is a data warehousing infrastructure based on Hadoop. Hive is designed to enable easy data summarization, ad-hoc querying and analysis of large volumes of data. It provides a simple query language called Hive QL, which is based on SQL and which enables users familiar with SQL to do ad-hoc querying, summarization and data analysis easily. I recommended To learn Programming Hive – Allan Gates book Believe me any Developers having intermediate knowledge on any one of the Database can able to pick up this easily , quickly and expertise it. When i say intermediate knowledge on Database , i am referring like an individuals has knowledge on Table Creation,Select queries and different clauses,Join Queries, DML Operations,Basic Database creation script knowledge, Indexes and Partitions. Thats it . This should be sufficient for anyone to understand most of the topics in HIVE. Hive has its own features and Data Model Approach which you will come to know when you read it . Then Your brain will start comparing your left and right eyes to know which is best :)
  3. 3. Hive Installation 1. Download the stable version of tarbal. hive-0.11.0.tar.gz Release notes link
  4. 4. Hive Installation ... 2.Copy the downloaded package to /usr/local kannan@kannandreams:/usr/local$ ls -ltr total 192652 -rw-r–r– 1 root root 74945460 Dec 5 00:59 hive-0.11.0.tar.gz kannan@kannandreams:/usr/local$ 3. unzip and change the owner sudo tar xzf hive-0.11.0.tar.gz sudo mv hive-0.11.0 hive sudo chown -R hduser:hadoop hive chown command change the owner of the directory hive from root to hadoop user hduser.
  5. 5. Hive Installation ... 4.Login to Hadoop user hduser and set the environment variables. kannan@kannandreams:/usr/local$ su – hduser Password: hduser@kannandreams:~$ vi .bashrc Add the below two lines in ~/.bashrc file and save it. #Hive env variables export HIVE_HOME=”/usr/local/hive” export PATH=$PATH:$HIVE_HOME/bin hduser@kannandreams:~$ . .bashrc ( source the file to reflect the env. values)
  6. 6. Note to Remember Hadoop services should be running to work in Hive Start the Hadoop services with the command
  7. 7. Hive Shell hduser@kannandreams:~$ cd $HIVE_HOME hduser@kannandreams:/usr/local/hive$ hive Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common0.11.0.jar!/ Hive history file= /tmp/hduser/hive_job_log_hduser_6282@kannandreams_201312050123_1791 376162.txt hive>
  8. 8. Hive Shell ... Test by creating a sample table and show tables statement – list the tables available in database. hive> show tables; OK Time taken: 6.84 seconds hive> create table test (Id INT); OK Time taken: 0.605 seconds hive> show tables; OK test Time taken: 0.1 seconds, Fetched: 1 row(s) hive>quit;
  9. 9. Hive Directory If you notice in HDFS Directory, Hive create the below directory by default based on configuration XML file. I didn’t mentioned in detail about the conf. xml file. drwxr-xr-x – hduser supergroup 0 2013-12-05 01:33 /user/hive drwxr-xr-x – hduser supergroup 0 2013-12-05 01:39 /user/hive/warehouse drwxr-xr-x – hduser supergroup 0 2013-12-05 01:39 /user/hive/warehouse/test
  10. 10. Thank You !!! Now we got the new job “apiarist” :) mail : @kannanpoem on twitter Blog: FB Community: HUGE - Hadoop User Group & Enthusiasts Huge , Yes Its All about "BIG" Data This has been created to build a group to get expertise and experts in Hadoop and Big Data .