Apache Hive
The Apache Hive™ data warehouse software facilitates reading, writing, and managing large datasets residing in distributed storage and queried using SQL syntax.

Built on top of Apache Hadoop™, Hive provides the following features:

Tools to enable easy access to data via SQL, thus enabling data warehousing tasks such as extract/transform/load (ETL), reporting, and data analysis.
A mechanism to impose structure on a variety of data formats
Access to files stored either directly in Apache HDFS™ or in other data storage systems such as Apache HBase™

Query execution via Apache Tez™, Apache Spark™, or MapReduce
Procedural language with HPL-SQL
Sub-second query retrieval via Hive LLAP, Apache YARN and Apache Slider.
Hive provides standard SQL functionality, including many of the later SQL:2003 and SQL:2011 features for analytics.
Hive's SQL can also be extended with user code via user defined functions (UDFs), user defined aggregates (UDAFs), and user defined table functions (UDTFs).

There is not a single "Hive format" in which data must be stored. Hive comes with built in connectors for comma and tab-separated values (CSV/TSV) text files, Apache Parquet™, Apache ORC™, and other formats.
Users can extend Hive with connectors for other formats. Please see File Formats and Hive SerDe in the Developer Guide for details.

Hive is not designed for online transaction processing (OLTP) workloads. It is best used for traditional data warehousing tasks.
Hive is designed to maximize scalability (scale out with more machines added dynamically to the Hadoop cluster), performance, extensibility, fault-tolerance, and loose-coupling with its input formats.

Components of Hive include HCatalog and WebHCat.

HCatalog is a component of Hive. It is a table and storage management layer for Hadoop that enables users with different data processing tools — including Pig and MapReduce — to more easily read and write data on the grid.
WebHCat provides a service that you can use to run Hadoop MapReduce (or YARN), Pig, Hive jobs or perform Hive metadata operations using an HTTP (REST style) interface.

Apache Hive 数据仓库软件使存储在分布式存储上的大数据集的读写和管理变得很容易,它用SQL语法进行查询。

Hive 构建在Apache Hadoop之上,提供以下功能:

1、通过SQL轻松访问数据,从而实现数据仓库任务,如提取/转换/加载(ETL),报告和数据分析。

2、一种在多种数据格式上强加结构的机制

3、访问直接存储在Apache HDFS 或其他数据存储系统(如Apache HBase)中的文件

4、通过Apache Tez 、Apache Spark 或者MapReduce 执行查询

5、程序语言HPL-SQL

6、通过Hive LLAP(Live Long And Process)、Apache YARN 和Apache Slider 进行亚秒级的查询检索

Hive 提供标准的SQL功能,包括许多SQL:2003和SQL:2011的分析功能。

Hive 的SQL还可以使用用户代码(如通过用户定义的函数UDFs、用户定义的聚合UDAFs和用户自定义的表函数UDTFs)进行扩展。

并没有所谓的存储数据的Hive 格式。Hive 内置连接器,用于CSV/TSV、Apache Parquet、Apache ORC 和其他格式。

Hive 不适用于在线事务处理(OLTP:online transaction processing )工作负载。它最适用于传统的数据仓库任务。

Hive 旨在最大限度地提高可扩展性(通过向Hadoop 集群动态添加更多计算机来扩展)、性能、容错以及与输入格式的松散耦合。

Hive 的组件包括HCatalog 和 WebHCat。

HCatalog 是Hadoop 的表和存储管理层,使具有不同数据处理工具(包括Pig 和MapReduce)的用户能够更轻松地在网络上读写数据。

WebHCat 提供的服务可用于运行Hadoop MapReduce(或YARN)、Pig、Hive 作业或使用REST风格的HTTP接口来执行Hive 元数据操作。

本次研究hive版本为2.3.4版本。

用hive命令启动hive命令行时报“Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.”,说明在hive2之后,就不推荐用MapReduce了,推荐用spark或者tez。

学习官方Getting Started文档,小结:

Hive 是依赖Hadoop的,所以在启动hive之前,要启动hdfs和yarn

在启动hive之前,先在hdfs上创建/tmp目录和/user/hive/warehouse目录,这里的/user/hive/warehouse目录是由hive-default.xml.template文件中的hive.metastore.warehouse.dir属性指定的,可以更改。

大部分都可以按照文档正常往下走,除了有几个坑:

1、在启动hiveServer2前,必须将hive-site.xml文件(hive配置文件,从hive-default.xml.template文件复制重命名所得,在此文件中修改属性值,hive会先读取hive-default.xml.template文件,再读取hive-site.xml文件,如果有重复的,则hive-site.xml文件中的值会覆盖前者的值)中所有的system:java.io.tmpdir 和 system:user.name 的值都替换成绝对路径。

2、在启动hiveserver2之前,需要设置hive-site.xml文件中的hive.metastore.schema.verification值为false,不然会报各种奇怪的错误,影响入门学习。以后可以详细了解下这个参数。

xml中该属性解释如下

<property>
    <name>hive.metastore.schema.verification</name>
    <value>true</value>
    <description>
    Enforce metastore schema version consistency.
    True: Verify that version information stored in is compatible with one from Hive jars. Also disable automatic
    schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
    proper metastore schema migration. (Default)
    False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
    </description>
</property>

3、如果采用其他数据库存放元数据,如mysql、postgresql,则需要在hive-site.xml文件中配置连接串、驱动类、用户名及密码。

4、额外配置下hadoop的core-site.xml文件,参考https://www.cnblogs.com/lijinze-tsinghua/p/8563054.html

5、初始化hive元数据表,命令是:schematool -initSchema -dbType postgres ,如果用mysql的话,则用mysql替换postgres。

启动hiveserver2。后台启动命令是:nohup hive --service hiveserver2 &

如果启动时报"Name node is in safe mode",则执行hadoop命令:hdfs dfsadmin -safemode leave,退出安全模式,之后,再执行hadoop命令:hdfs fsck -delete,删掉missing block即可。

假如想在hive服务器上看hive数据库和表情况,可通过beeline命令行查看。执行beeline命令时需要显式指定用户,格式是beeline -u jdbc:hive2://hs2_host:hs2_port -n root,例如beeline -u jdbc:hive2://linux-node1:10000 -n root,不然会报“Permission denied: user=anonymous, access=EXECUTE, inode="/tmp":root:supergroup:drwx-w----”。从报错信息中可以看出,如果不显式指定用户的话,就会采用anonymous用户。

hive Getting Started的更多相关文章

  1. 初识Hadoop、Hive

    2016.10.13 20:28 很久没有写随笔了,自打小宝出生后就没有写过新的文章.数次来到博客园,想开始新的学习历程,总是被各种琐事中断.一方面确实是最近的项目工作比较忙,各个集群频繁地上线加多版 ...

  2. Hive安装配置指北(含Hive Metastore详解)

    个人主页: http://www.linbingdong.com 本文介绍Hive安装配置的整个过程,包括MySQL.Hive及Metastore的安装配置,并分析了Metastore三种配置方式的区 ...

  3. Hive on Spark安装配置详解(都是坑啊)

    个人主页:http://www.linbingdong.com 简书地址:http://www.jianshu.com/p/a7f75b868568 简介 本文主要记录如何安装配置Hive on Sp ...

  4. HIVE教程

    完整PDF下载:<HIVE简明教程> 前言 Hive是对于数据仓库进行管理和分析的工具.但是不要被“数据仓库”这个词所吓倒,数据仓库是很复杂的东西,但是如果你会SQL,就会发现Hive是那 ...

  5. 基于Ubuntu Hadoop的群集搭建Hive

    Hive是Hadoop生态中的一个重要组成部分,主要用于数据仓库.前面的文章中我们已经搭建好了Hadoop的群集,下面我们在这个群集上再搭建Hive的群集. 1.安装MySQL 1.1安装MySQL ...

  6. hive

    Hive Documentation https://cwiki.apache.org/confluence/display/Hive/Home 2016-12-22  14:52:41 ANTLR  ...

  7. 深入浅出数据仓库中SQL性能优化之Hive篇

    转自:http://www.csdn.net/article/2015-01-13/2823530 一个Hive查询生成多个Map Reduce Job,一个Map Reduce Job又有Map,R ...

  8. Hive读取外表数据时跳过文件行首和行尾

    作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 转载请注明出处 有时候用hive读取外表数据时,比如csv这种类型的,需要跳过行首或者行尾一些和数据无关的或者自 ...

  9. Hive索引功能测试

    作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 转载请注明出处 从Hive的官方wiki来看,Hive0.7以后增加了一个对表建立index的功能,想试下性能是 ...

  10. 轻量级OLAP(二):Hive + Elasticsearch

    1. 引言 在做OLAP数据分析时,常常会遇到过滤分析需求,比如:除去只有性别.常驻地标签的用户,计算广告媒体上的覆盖UV.OLAP解决方案Kylin不支持复杂数据类型(array.struct.ma ...

随机推荐

  1. mybatis Mapper.xml和Mapper.java

    mybatis Mapper.xml和Mapper.java 通过Mapper.xml和Mapper.java来实现mybatis.环境和入门的一样的.关键:Mapper.xml + Mapper.j ...

  2. java 访问HTTPS rest服务

    import java.io.*;import java.net.*;import java.security.cert.CertificateException;import java.securi ...

  3. VS 和Visual Assist X快捷键(转)

    Visual Assist X 最有用的快捷键 1.Alt + G: 在定义与声明之间互跳. 2.Alt + O: 在.h与.cpp之间互跳.(O是字母O,不是数字零) 3.Alt + Shift + ...

  4. [LeetCode 题解]: Maximum Subarray

    前言   [LeetCode 题解]系列传送门:  http://www.cnblogs.com/double-win/category/573499.html   1.题目描述 Find the c ...

  5. 学习笔记之Struts2—浅析接收参数

    最近自己通过视频与相关书籍的学习,对action里面接收参数做一些总结与自己的理解. 0.0.接收参数的(主要)方法   使用Action的属性接收参数 使用DomainModel接收参数 使用Mod ...

  6. C# Pinvoke判断是UEFI模式还是BIOS模式

    [DllImport("kernel32.dll", SetLastError = true)] public static extern UInt32 GetFirmwareEn ...

  7. ZKEACMS 配置使用 HTTPS

    在开始之前,请升级你的ZKEACMS到最新版本,旧版本使用HTTPS会有问题 https加密链接,在访问的过程中,可以保护你的隐私,保证你的敏感数据不会被别人偷窥,窃取.如果你的服务器在境外,使用ht ...

  8. 快速搭建windows服务器的可视化运维环境

    开发好的程序部署在服务器上,如何对服务器的基本指标进行监控呢?最近对一套工具进行了研究,可以快速搭建服务器监管环境,很是强大,最重要的是它还很酷炫. 原理:数据采集+时序数据库+可视化,下面记录一下搭 ...

  9. BZOJ 1562 [NOI2009] 变换序列

    [NOI2009] 变换序列 [题解] 就是有一个序列,每个位置可以填两个数,不可重复,问最小字典序. 显然,可以建一个二分图,判合法就是找完美匹配. 那怎么弄最小字典序呢?有好多种解法,我这里给出了 ...

  10. 动态添加select的option [转载]

    动态给select标签添加option,结合前人经验以及自己经验,现在总结三种方法供大家参考,一起交流学习!首先是定义的select元素://根据ID获得select元素 var mySelect = ...