HIVE INSTALLATION
来源:互联网 发布:免费淘宝联盟推广软件 编辑:程序博客网 时间:2024/04/30 13:25
This section refers to the installation settings of Hive on a standalone systemas well as on a system existing as a node in a cluster.
INTRODUCTION
Apache Hive is a data warehouse infrastructure built on top of Hadoop for providing data summarization, query, and analysis. Apache Hive supports analysis of large datasets stored in Hadoop’s HDFS and compatible file systems such as Amazon S3 filesystem. It provides an SQL-like language called HiveQL(Hive Query Language) while maintaining full support for map/reduce.
Hive Installation
Installing HIVE:
Browse to the link: http://apache.claz.org/hive/stable/
Click the apache-hive-0.13.0-bin.tar.gz
Save and Extract it
Commands
user@ubuntu:~$ cd /usr/lib/user@ubuntu:~$ sudo mkdir hiveuser@ubuntu:~$ cd Downloadsuser@ubuntu:~$ sudo mv apache-hive-0.13.0-bin /usr/lib/hive
Setting Hive environment variable:
Commands
user@ubuntu:~$ cduser@ubuntu:~$ sudo gedit ~/.bashrc
Copy and paste the following lines at end of the file
# Set HIVE_HOMEexport HIVE_HOME="/usr/lib/hive/apache-hive-0.13.0-bin"PATH=$PATH:$HIVE_HOME/binexport PATH
Setting HADOOP_PATH in HIVE config.sh
Commands
user@ubuntu:~$ cd /usr/lib/hive/apache-hive-0.13.0-bin/binuser@ubuntu:~$ sudo gedit hive-config.sh
Go to the line where the following statements are written
# Allow alternate conf dir location.HIVE_CONF_DIR="${HIVE_CONF_DIR:-$HIVE_HOME/conf"export HIVE_CONF_DIR=$HIVE_CONF_DIRexport HIVE_AUX_JARS_PATH=$HIVE_AUX_JARS_PATH
Below this write the following
export HADOOP_HOME=/usr/local/hadoop (write the path where hadoop file is there)
Create Hive directories within HDFS
Command
user@ubuntu:~$ hadoop fs -mkdir /usr/hive/warehouse
Setting READ/WRITE permission for table
Command
user@ubuntu:~$ hadoop fs -chmod g+w /usr/hive/warehouse
HIVE launch
Command
user@ubuntu:~$ hive
Hive shell will prompt:
OUTPUT
Shell will look like
Logging initialized using configuration in jar:file:/usr/lib/hive/apache-hive-0.13.0-bin/lib/hive- common-0.13.0.jar!/hive-log4j.propertieshive>
Creating a database
Command
hive> create database mydb;
OUTPUT
OKTime taken: 0.369 secondshive>
Configuring hive-site.xml:
Open with text-editor and change the following property
<property> <name>hive.metastore.local</name> <value>TRUE</value> <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description></property><property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://usr/lib/hive/apache-hive-0.13.0-bin/metastore_db? createDatabaseIfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description></property><property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description></property><property> <name>hive.metastore.warehouse.dir</name> <value>/usr/hive/warehouse</value> <description>location of default database for the warehouse</description> </property>
Writing a Script
Open a new terminal (CTRL+ALT+T)
user@ubuntu:~$ sudo gedit sample.sqlcreate database sample;use sample;create table product(product int, productname string, price float)[row format delimited fields terminated by ',';]describe product;
load data local inpath ‘/home/hduser/input_to_product.txt’ into table product
select * from product;
SAVE and CLOSE
user@ubuntu:~$ sudo gedit input_to_product.txtuser@ubuntu:~$ cd /usr/lib/hive/apache-hive-0.13.0-bin/ $ bin/hive -f /home/hduser/sample.sql
0 0
- Hive installation
- HIVE INSTALLATION
- Apache Hive Installation
- Hive学习5_Hive - Installation
- Hadoop and Spark and Hive Installation
- Hive----------Cannot find hadoop installation: $HADOOP_HOME m...
- 解决Hive installation issues: Hive metastore database is not initialized
- 解决Hive installation issues: Hive metastore database is not initialized
- Hive
- HIVE
- Hive
- hive
- hive
- hive
- hive
- hive
- Hive
- hive
- akka-actor(嘿咻demo)
- Spring+Maven+Dubbo+MyBatis+Linner+Handlebars—Web开发环境搭建
- 2016
- ntfs物理磁盘解析 --发文于2013-9-24
- CortexM3
- HIVE INSTALLATION
- 数据挖掘与数据分析
- 1012: [JSOI2008]最大数maxnumber
- 【总结】EJB开发过程中遇到的几个问题
- 类似于qq音乐底部弹出的popwindow
- Cannot change version of project facet Dynamic Web Module to 2.5.
- Syntax error, annotations are only available if source level is 1.5
- 使用Visual Studio对项目重命名
- 启动控制面板中的applet时的一点笔记--发文于2013-10-22