1. Hive download


   wget   http://~~~/apache-hive-1.2.1-bin.tar.gz


2. Hive install


   1) embedded type


      tar –xzvf apache-hive-1.2.1-bin.tar.gz

      export HIVE_HOME=hive home directory 

      export PATH=$HIVE_HOME/bin:$PATH

      $> hive

      hive> show tabels;



   2) local metastore


      tar –xzvf apache-hive-1.2.1-bin.tar.gz

      export HIVE_HOME=hive home directory 

      export PATH=$HIVE_HOME/bin:$PATH


      -- mysql config

      yum install mysql-server

      

      -- mysql connector for connectiong between mysql and hive

      http://dev.mysql.com/downloads/connector/j/


      -- hive-site.xml에 metastore 정보 설정

<configuration>

<property>

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

<value>jdbc:mysql://localhost:3306/metastore_db?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>hive</value>

<description>user name for connecting to mysql server     

</description>

</property>

<property>

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

<value>passwd</value>

<description>password for connecting to mysql server</description>

</property>

</configuration>


$> hive


  3) remote metastore


    2) local metastore 설정까지 동일하고 추가적으로 아래와 같이 설정


    bin/hive --service metastore &

    $> hive

    $> netstat -an | grep 9083  ( metastore interface )



3. HCatalog 설정

   remote metastore 설정이 완료된 다음 HCatalog 설정

 

   hcat           : print a usage message

   hcat -g test  : test group 생성

   

4. Hive components


   1) hive metastore

      RDB datastore에 database, table, schema, other entities를 조회하는 api 제공


      hvie --service metastore &


   2) hiveserver2   

      클라이언트에게 Hive 쿼리 수행 및 결과를 얻을수 있는 interface제공 (Thrift RPC)


      hive --service hiveserver2 &


   3) hive clients


      - Hive Cli : interactive and batch mode query 환경 제공

      - beeline : interact with hive through Hiveserver2

        $HIVE_HOME/bin/beeline   (username and password)

        beeline -u <database url> -n <username> -p <password> -e <query> -f <file>

        beeline -u 'jdbc:hive2://localhost:10000/default' -n root -p xxx -d org.apache.hive.jdbc.HiveDriver -e "select * from sales;"


5. Hive execute

   1) hive cli

      $HIVE_HOME/bin/hive


   2) hiveserver2 and beeline

      $HIVE_HOME/bin/hiveserver2

      (설정 참조 : https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-HiveServer2)

      $HIVE_HOME/bin/beeline -u jdbc:Hive2://$hostserver2_host:$port


   3) hcatalog and hcatalog server

      $HIVE_HOME/hcatalog/sbin/hcat_server.sh


   4) hcatalog cli

      $HIVE_HOME/hcatalog/bin/hcat


   5) webhcat

      $HIVE_HOME/hcatalog/sbin/webhcat_server.sh




  

   

'NoSQL > Hive' 카테고리의 다른 글

Hive configuration  (0) 2016.06.14
Hive Debug  (0) 2016.06.14
Hive metastore  (0) 2016.06.13
Hive 구성  (0) 2016.06.10
Hive Data Types  (0) 2016.06.09

+ Recent posts