Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


[Udemy] - Hive to ADVANCE Hive (Real time usage): Hadoop querying tool

08 Sep 2022 »

Install Cloudera Hortonworks Sandbox

https://www.cloudera.com/downloads/hortonworks-sandbox/hdp.html

Docker

yum -y install docker
curl -o https://archive.cloudera.com/hwx-sandbox/hdp/hdp-3.0.1/HDP_3.0.1_docker-deploy-scripts_18120587fc7fb.zip
unzip HDP_3.0.1_docker-deploy-scripts_18120587fc7fb.zip
bash docker-deploy-hdp30.sh

http://hadoop:1080/splash.html

homepage

dashboard

ambari

http://hadoop:8080/#/main/dashboard/metrics

ResourceManager UI

http://hadoop:8088/ui2/#/cluster-overview

queue

hadoop NameNode UI

http://hadoop:50070/dfshealth.html#tab-overview

From scratch

Another version from “Hive-bench study”

Class

  • Hive Basic Commands
    • create database if not exists d1;
    • create database if not exists d2 comment 'this is a database';
    • describe database extended d2;
    • create database if not exists d3 withdbproperties('creator'='jivesh', data'2017-12-01')
    • show databases;
    • create table
      • 499,Poole:GBR,England,141000
        501,Blackburn:GBR,England,140000
        500,Bolton:GBR,England,139020
        502,Newport:GBR,Wales,139000
        503,PrestON:GBR,England,135000
        504,Stockport:GBR,England,132813
        
      • create table if not exists table3(col1 int,col2 array<string>,col3 string,col4 int)row format delimited fields terminated by',' collection items terminated by':' lines terminated by'\n' stored as textfile;
      • create table if not exists table2(col1 string,cols2 array<string>,cold3 string,col4 int)
      • create external table if not exists table2(col1 int,col2 array<string>,col3 string,col4 int)row format delimited fields terminated by',' collection items terminated by':' lines terminated by'\n' stored as textfile location'/user/jivesh/emp';
      • load data local inpath'/home/jivesh/files/table1'into table table2;
      • create table map local file
        • create table if not exists table3(col1 int,col2 array<string>,col3 string,col4 int)row format delimited fields terminated by',' collection items terminated by':' lines terminated by'\n' stored as textfile location '/user/hive/table3';
        • load data local inpath '/tmp/table1.txt' into table table3;
        • select * from table3;
        •   +--------------+----------------------+--------------+--------------+
            | table3.col1  |     table3.col2      | table3.col3  | table3.col4  |
            +--------------+----------------------+--------------+--------------+
            | 499          | ["Poole","GBR"]      | England      | 141000       |
            | 501          | ["Blackburn","GBR"]  | England      | 140000       |
            | 500          | ["Bolton","GBR"]     | England      | 139020       |
            | 502          | ["Newport","GBR"]    | Wales        | 139000       |
            | 503          | ["PrestON","GBR"]    | England      | 135000       |
            | 504          | ["Stockport","GBR"]  | England      | 132813       |
            +--------------+----------------------+--------------+--------------+