February 13, 2020

[Note] Installing Hive, HBase

Environment: Ubuntu 18 Server 64-bit on VirtualBox host Windows 10
Prerequisite: Hadoop Install

Install Hive

Download, http://apache-mirror.8birdsvideo.com/hive/hive-2.3.6/apache-hive-2.3.6-bin.tar.gz

Uncompress and install in /opt/hive

Prep env vars

$ vi ~/.bashrc
# --- hive
export HIVE_HOME=/opt/hive
export HIVE_CONF_DIR=$HIVE_HOME/conf
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$(hadoop classpath)
export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib/*


$ . ~/.bashrc

Copy and set environment script

$ cd /opt/hive/conf
$ cp hive-env.sh.template hive-env.sh
$ vi hive-env.sh
HADOOP_HOME=/opt/hadoop


Copy default config

$ cd /opt/hive/conf
$ cp hive-default.xml.template hive-default.xml


Prep Hadoop FS

$ hdfs dfs -mkdir -p /user/hduser/warehouse
$ hdfs dfs -mkdir /tmp
$ hdfs dfs -chmod g+w /user/hduser/warehouse
$ hdfs dfs -chmod g+w /tmp


Prep metadata db

$ schematool -initSchema -dbType derby


Test

$ hive
hive> create database test;
hive> show databases;


See here for more info:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual
https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-InstallationandConfiguration


Install HBase

Download,
https://hbase.apache.org/downloads.html
https://www-us.apache.org/dist/hbase/hbase-1.4.12/hbase-1.4.12-bin.tar.gz

Uncompress and install at /opt/hbase

Setup

$ vi /opt/hbase/conf/hbase-env.sh
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64


$ vi ~/.bashrc
export HBASE_HOME=/opt/hbase
export PATH= $PATH:$HBASE_HOME/bin

$ mkdir -p /data/hbase/hfiles
$ mkdir -p /data/hbase/zookeeper

$ vi /opt/hbase/conf/hbase-site.xml
<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://localhost:9000/hbase</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/data/hbase/zookeeper</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
</configuration>


Start

/opt/hbase/bin$ ./start-hbase

Test

$ hadoop fs -ls /hbase

See here for more info, https://hbase.apache.org/book.html#quickstart

hbase(main):001:0> create 'test', 'cf'
hbase(main):002:0> list 'test'



No comments:

Post a Comment