刚看了hive官网的文档,对于一些概念结合自己的经验,似乎又多了一些理解,想一想还是记下来的好,一来我是个有些健忘的人,过一段时间即便忘了,循着这个帖子,也能快速把知识点抓起来;二来或许对别人也有些启发。不过首先声明,只是我自己的理解,或许也有错误的地方。。

  1. 先吐个槽,hive的官方文档页面导航就是坨翔,当然,内容还是比较充实的。文档并没有分版本,只是在具体某些内容中对不同版本区别介绍;自己菜单的链接点击后,是一个全新的页面,导航实在太不友好了。

  2. metastore

  hive在部署时,要配置hive-site.xml,这里面的配置很重要的一部分是针对metastore的。什么是metastore?官方解释:"All the metadata for Hive tables and partitions are accessed through the Hive Metastore. ",简单翻一下“对所有hive原数据和分区的访问都要通过Hive Metastore”。

另有一段,附我的翻译:

 Remote Metastore Server
In remote metastore setup, all Hive Clients will make a connection to a metastore server which in turn queries the datastore (MySQL in this example)
for metadata. Metastore server and client communicate using Thrift Protocol. Starting with Hive 0.5., you can start a Thrift server by executing
the following command: 远程metastore服务:
启动远程metastore后,hive客户端连接metastore服务,从而可以从数据库(本例中位mysql)查询到原数据信息。metastore服务端和客户端通信是通过thrift协议。从hive 0.5.0版本开始,你可以通过执行
以下命令来启动thrift服务。 hive --service metastore

  所以,metastore服务实际上就是一种thrift服务,通过它我们可以获取到hive原数据,并且通过thrift获取原数据的方式,屏蔽了数据库访问需要驱动,url,用户名,密码等等细节。

另外需要说明,以上说的是metastore服务(metastore server)的概念。我们后面还会提到metastore数据库(metastore database),metastore 客户端(metastore client)的概念,但其实metastore服务(metastore server)是理解metastore最重要的概念,所以在这里提前单独提到了。

hive中对metastore的配置包含3部分,metastore database,metastore server,metastore client。

其中,metastore database分为Local/Embedded Metastore Database (Derby)和Remote Metastore Database,metastore server也分为Local/Embedded Metastore Server和Remote Metastore Server,本地配置既无太大意义,又要占不少篇幅,我就不讲了,后面的例子都是远程相关配置。

需要注意的几点:

  1)Remote metastore server并不需要额外配置,只要Remote Metastore Database配置好了,"hive --service metastore" 启动metastore会寻找database相关配置。

  2)通常我配置了database,就不配置client了。一般我们的hive都是做服务端的情况较多,不用作为客户端,当然不用客户端的配置了。但是如果仅作为客户端,database配置就不需要了,服务端连元数据库,和客户端没半毛钱直接关系,当然就不需要配置了,但如果作为客户端,而且还要启动hiveServer2服务(该服务也需要访问元数据),那database也是必须配置的。还有一种情况,既是服务端又是客户端,不用说了,都配置上吧。 废话了一大堆,总结一句话,配置多了,一般不会出问题,配少了,就呵呵呵了。。

  3)metastore服务端,客户端的应用场景。spark sql,spark shell终端连接应该就是以客户端的形式连接 hive的metastore服务的。难怪看到官方文档中说准备在3.0版本将metastore独立出去。本来嘛,获取元数据的小活,为什么非得要整合在hive中。

Remote Metastore Database:

Config Param

Config Value

Comment

javax.jdo.option.ConnectionURL

jdbc:mysql://<host name>/<database name>?createDatabaseIfNotExist=true

metadata is stored in a MySQL server

javax.jdo.option.ConnectionDriverName

com.mysql.jdbc.Driver

MySQL JDBC driver class

javax.jdo.option.ConnectionUserName

<user name>

user name for connecting to MySQL server

javax.jdo.option.ConnectionPassword

<password>

password for connecting to MySQL server

metastore client Parameters

Config Param

Config Value

Comment

hive.metastore.uris

thrift://<host_name>:<port>

host and port for the Thrift metastore server

hive.metastore.local

false

Metastore is remote.  Note: This is no longer needed as of Hive 0.10.  Setting hive.metastore.uri is sufficient.

hive.metastore.warehouse.dir

<base hdfs path>

Points to default location of non-external Hive tables in HDFS.

  3. hiveServer2

  同样,看一段官方解释:

HiveServer2 (HS2) is a server interface that enables remote clients to execute queries against Hive and retrieve the results (a more detailed intro here).
The current implementation, based on Thrift RPC, is an improved version of HiveServer and supports multi-client concurrency and authentication.

HiveServer2(HS2)是一个服务端接口,使远程客户端可以执行对Hive的查询并返回结果。目前基于Thrift RPC的实现是HiveServer的改进版本,并支持多客户端并发和身份验证

  hiveServer2的启动方式有2种:

 $HIVE_HOME/bin/hiveserver2
或者
$HIVE_HOME/bin/hive --service hiveserver2

启动hiveServer2服务后,就可以使用jdbc,odbc,或者thrift的方式连接。 用java编码jdbc或则beeline连接使用jdbc的方式,据说hue是用thrift的方式连接的hive服务。

我的一点疑问,hiveServer2和metastore都会访问元数据,他们的访问方式是怎样的?是相同的,还是相似的。元数据的访问有没有可能仅需要一个服务?我现在访问hive服务需要启动hiveServer2,访问sparksql需要启动metastore,如果两个都会启动metastore,我觉得有些奇怪。

hiveServer2 和 metastore的一点解读。的更多相关文章

  1. 对于devexpress gridview 内插图加加进度条等的一点解读

    如上图,gategory 加了小图标, 其他行内还有计算器,大图片   进度条等 using System; using System.Drawing; using System.Collection ...

  2. Python装饰器的一点解读

    版权申明:本文为博主窗户(Colin Cai)原创,欢迎转帖.如要转贴,必须注明原文网址 http://www.cnblogs.com/Colin-Cai/p/12977127.html 作者:窗户 ...

  3. Hive为什么要启用Metastore?

    转载来自: https://blog.csdn.net/qq_40990732/article/details/80914873 https://blog.csdn.net/tp15868352616 ...

  4. Hive扩展功能(四)--HiveServer2服务

    软件环境: linux系统: CentOS6.7 Hadoop版本: 2.6.5 zookeeper版本: 3.4.8 主机配置: 一共m1, m2, m3这五部机, 每部主机的用户名都为centos ...

  5. C#码农的大数据之路 - 使用C#编写MR作业

    系列目录 写在前面 从Hadoop出现至今,大数据几乎就是Java平台专属一般.虽然Hadoop或Spark也提供了接口可以与其他语言一起使用,但作为基于JVM运行的框架,Java系语言有着天生优势. ...

  6. Hive 3.x 配置&详解

    Hive 1. 数据仓库概述 1.1 基本概念 数据仓库(英语:Data Warehouse,简称数仓.DW),是一个用于存储.分析.报告的数据系统. 数据仓库的目的是构建面向分析的集成化数据环境,分 ...

  7. Python自动化测试(1)-自动化测试及基本技术手段概述

    生产力概述 在如今以google为首的互联网时代,软件的开发和生产模式都已经发生了变化, 在<参与感>一书提到:某位从微软出来的工程师很困惑,微软在google还有facebook这些公司 ...

  8. 一.Kylin的伪分布式安装

    一.伪分布式安装kylin 2018年4月15日 15:06 安装需要的环境 1. hadoop集群环境:由于安装的是CDH5.14.0的版本,所以相关组件都是跟5.14.0相关 2. spark采用 ...

  9. Modern Data Lake with Minio : Part 2

    转自: https://blog.minio.io/modern-data-lake-with-minio-part-2-f24fb5f82424 In the first part of this ...

随机推荐

  1. Linux学习小记(1)

    学习Linux,进行阶段性总结,权当笔记方便日后翻阅和查看. 在此特别推荐peida的博客,他的有关Linux的理解个人感觉深入浅出,很适合入门的小白来理解和学习. 说一说针对IP的修改,ifconf ...

  2. STL基础4:deque

    #include <iostream> #include <queue> #include <string> using namespace std; #defin ...

  3. liunx Ubuntu 设置IP、网关、DNS

    说明:在网上给的教程上面通常会有这样的一个误导思路,按照配置文件设置后会不生效的问题,甚至没有一点效果,经过排查发现Linux下设置IP这个话题的入口线索应该分为两种:1为Server版,2为Desk ...

  4. java 日志框架

    1.java常用日志框架介绍: https://www.cnblogs.com/chenhongliang/p/5312517.html 2.java各类日志组件汇总: https://blog.cs ...

  5. Android-Java-饿汉式单例模式(内存图)

    描述Single对象: package android.java.oop14; public class Single { // 默认构造方法 私有化 不让外界调用 private Single() ...

  6. Lambda表达式where过滤数据

    使用Lambda的表达式来过滤符合条件的数据.下面的代码实现,是把字符阵列中,把名字长度等于3元素找出来. class Bv { public void LambdaExpression() { st ...

  7. react中使用vw + antd-mobile进行移动端布局

    首先create-react-app react-vw一顿简单操作生成个demo 1.cnpm run eject 暴露config文件,再cnpm run start报错 (报错...  Canno ...

  8. 火狐浏览器安装 Modify Headers 插件

    一.火狐浏览器插件安装 这里以火狐浏览器的Modify Headers插件安装为例,展示火狐插件的安装: 1.打开火狐浏览器,右上角选择“附加组件” 2.搜索Modify Headers插件 3.安装 ...

  9. vue 自学笔记(4): 样式绑定与条件渲染

    一:对象绑定 Vue 对于页面的样式加载也有独特的方式,按照 Vue 提供的方式,我们可以轻松的控制它们的呈现. 假使我们要实现点击 div 变色 Vue 提供的样式方案的本质是对元素节点进行属性的绑 ...

  10. Autowired byType 与 byName 策略

    @Autowired是spring的注解,默认使用的是byType的方式向Bean里面注入相应的Bean.例如: @Autowiredprivate UserService userService;这 ...