简体   繁体   English

使用Shell远程查询Hive

[英]Query Hive remotely using shell

Let's imagine I have access to an Hive datawarehouse, I can query it using some webservice. 假设我可以访问Hive数据仓库,可以使用某些Web服务对其进行查询。 The problem is that I cannot automate the query using this service, so I would like to be able to query Hive from an external script (that I would be able to automate). 问题是我无法使用此服务自动执行查询,因此我希望能够从外部脚本查询Hive(使我能够自动执行)。

For now, I've only seen people running Hive on their local machine and querying it, I was wondering if it was possible to do it remotely ? 现在,我只看到有人在本地计算机上运行Hive并对其进行查询,我想知道是否可以远程进行? If yes, how ? 如果是,怎么办?

Thanks a lot ! 非常感谢 !

As far as I understood, you are asking if there are ways to connect to hive from a remote machine? 据我了解,您在问是否有方法可以从远程计算机连接到配置单元?

You could install hive client (beeline) on any remote machine and connect to hive via jdbc. 您可以在任何远程计算机上安装hive客户端(直线)并通过jdbc连接到hive。

Take a look here: https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients 在这里看看: https : //cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients

An easy way to do this, is to deploy the client configuration of hadoop/yarn on the remote machine. 一种简单的方法是在远程计算机上部署hadoop / yarn的客户端配置。 If the remote cluster is secured with firewalls and kerberos, you will need access to those first. 如果远程群集已使用防火墙和kerberos保护,则需要首先访问它们。 After that it's just a matter of starting up a hive shell or committing a job submit to Yarn. 之后,只需要启动配置单元外壳或提交作业即可。

When you use Cloudera, you might be able to add the host to the cluster and install a "gateway" role for yarn and hive on the target machine. 使用Cloudera时,您可能可以将主机添加到群集,并在目标计算机上为yarn和hive安装“网关”角色。 This is very straight-forward and requires just a few minutes of work. 这非常简单,只需几分钟的工作。

Alternatively using the JDBC connector should also work, as stated in Facha's answer. 如Facha的回答所述,也可以使用JDBC连接器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM