Hive HA (高可用)搭建

本文档详细介绍了如何使用Zookeeper在Hive中实现高可用性(HA)。通过Zookeeper服务发现功能,从Hive 0.14.0开始,HiveServer2支持高可用性和滚动升级。JDBC连接URL指定Zookeeper群集,允许应用在不直接暴露HDFS和Metastore的情况下与Hive交互,同时提供HA解决方案和多种语言支持。

官方文档

hive的搭建方式有三种,分别是

1、Local/Embedded Metastore Database (Derby)

2、Remote Metastore Database

3、Remote Metastore Server

一般情况下,我们在学习的时候直接使用hive –service metastore的方式启动服务端,使用hive的方式直接访问登录客户端,除了这种方式之外,hive提供了hiveserver2的服务端启动方式,提供了beeline和jdbc的支持,并且官网也提出,一般在生产环境中,使用hiveserver2的方式比较多: 

 使用hiveserver2的优点如下:

      1、在应用端不需要部署hadoop和hive的客户端

      2、hiveserver2不用直接将hdfs和metastore暴露给用户

      3、有HA机制,解决应用端的并发和负载问题

      4、jdbc的连接方式,可以使用任何语言,方便与应用进行数据交互

 hive的HA搭建

使用zookeeper完成HA:         

ZooKeeper-based service discovery introduced in Hive 0.14.0 (HIVE-7935) enables high availability and rolling upgrade for HiveServer2. A JDBC URL that specifies <zookeeper quorum> needs to be used to make use of these features.

With further changes in Hive 2.0.0 and 1.3.0 (unreleased, HIVE-11581), none of the additional configuration parameters such as authentication mode, transport mode, or SSL parameters need to be specified, as they are retrieved from the ZooKeeper entries along with the hostname.

The JDBC connection URL: jdbc:hive2://<zookeeper quorum>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 .

The <zookeeper quorum> is the same as the value of hive.zookeeper.quorum configuration parameter in hive-site.xml/hivserver2-site.xml used by HiveServer2.

Additional runtime parameters needed for querying can be provided within the URL as follows, by appending it as a ?<option> as before.

The JDBC connection URL: jdbc:hive2://<zookeeper quorum>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2?tez.queue.name=hive1&hive.server2.thrift.resultset.serialize.in.tasks=true 

 1、环境准备

Node01

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值