在 SQLClient 中访问 Hive 表,但不能从 Putty 访问 [英] Access Hive Tables in SQLClient but not from the Putty

查看:33
本文介绍了在 SQLClient 中访问 Hive 表,但不能从 Putty 访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Hive、MapReduce 和 Hadoop 的新手.我正在使用 Putty 连接到 hive 表并访问表中的记录.所以我所做的是 - 我打开 Putty 并在主机名中输入 - vip.name.com,然后单击 Open.然后我输入了我的用户名和密码,然后输入了几个命令来访问 Hive sql.以下是我所做的列表

I am new to Hive, MapReduce and Hadoop. I am using Putty to connect to hive table and access records in the tables. So what I did is- I opened Putty and in the host name I typed- vip.name.com and then I click Open. And then I entered my username and password and then few commands to get to Hive sql. Below is the list what I did

$ bash
bash-3.00$ hive
Hive history file=/tmp/rkost/hive_job_log_rkost_201207010451_1212680168.txt
hive> set mapred.job.queue.name=mdhi-technology;
hive> select * from table LIMIT 1;

所以我的问题是-

有没有其他方法可以在任何 Sql 客户端(如 Sql Developer 或 Squirel SQL 客户端)中执行相同的操作,而不是从命令提示符处执行.如果它在那里,那么考虑到我的示例,当我从 Putty 登录到 vip.name.com 时,执行此操作的分步过程是什么.

Is there any other way I can do the same thing in any Sql client like Sql Developer or Squirel SQL Client instead of doing it from the command prompt. And if it is there then what is the step by step process to do this considering my example as I am logging to vip.name.com from Putty .

如果我需要在我的 Windows 机器上通过 JDBC 程序来做同样的事情,那么我该怎么做.使用 JDBC 程序意味着我如何访问 Hive 表并获取结果.据我所知,我可以如何使用 oracle 表来做到这一点.但我唯一的困惑是,因为我使用这个主机名 vip.name.com 登录到 Putty.我希望这个问题很清楚.任何建议将不胜感激.

And same thing if I need to do through JDBC Program in my windows machine then how I can do it. Means with the JDBC Program, how I can access Hive tables and get the result back. As I know how I can do this with the oracle tables. But the only confusion I have is, as I am using this hostname vip.name.com to log into Putty. I am hoping the question is clear. Any suggestion will be appreciated.

简而言之,我的问题是 - 我可以在任何 SQLClient 中做同样的事情,而不是从 Putty 记录吗?

更新-

我尝试按照 Mark 建议的方式进行操作.但我总是得到 - Hive: 无法建立与 vip.host.com:10000/default: java.net.ConnectionException: Connection timed out: connect

I tried doing the way Mark has suggested me. But I am always getting- Hive: Could not establish connection to vip.host.com:10000/default: java.net.ConnectionException: Connection timed out: connect

推荐答案

你用 Putty 做什么是通过 SSH 连接到安装和设置 Hive 的机器.然后,您将从 Hive 命令行发出 Hive 查询.这是发出 Hive 查询的一种方式.还有其他不需要 SSH 的方法,您可能需要通过 JDBC 连接.

What are you doing with Putty is SSH'ing into a machine with Hive installed and set up. Then you are issuing Hive queries from the Hive command line. That is one way of issuing Hive queries. There are other ways that don't require SSH'ing, one you probably need is connection via JDBC.

这里是一篇描述如何连接到通过 JDBC 使用 SQuirreL 在 Amazon 的 EMR 集群上安装 Hive.这篇文章可能看起来是亚马逊特有的,但事实并非如此.只要您在集群的一个节点上运行 Hive 服务器,并且没有防火墙阻碍客户端计算机与运行 Hive 之间的连接,您就应该能够连接.

Here is an article which describes how to connect to a Hive installation on Amazon's EMR cluster using SQuirreL via JDBC. The article might appear to be Amazon specific but it's not. As long you have Hive server running on one of the nodes of the cluster and no firewall impeding connection between the client machine and one running Hive, you should be able to connect.

您可能需要记住与上述链接相关的几件事:

A couple things you might want to keep in mind related to the above link:

  • 除非您使用 EMR,否则您可以忽略第 3 步,它会要求您创建 SSH 隧道.
  • 您在连接 URI 中输入的端口可能与您的情况不同.将 localhost 替换为运行 Hive 的机器的完全限定域名.要找出 Hive 服务器正在侦听的端口,您可以查看日志目录中存在的 Hive 服务器保姆日志文件(其位置取决于您的安装)或运行简单的 netstat -a 命令.我相信 10000 是默认端口号,因此直接尝试 10000 可能有意义.
  • You can ignore step 3 where it asks you to create a SSH tunnel unless you are using EMR.
  • The port that you enter in your connection URI might be different in your case. Replace localhost with the fully qualified domain name of the machine that Hive is running on. To find out which port Hive server is listening on, you can look into your Hive server nanny log file present in the log directory (whose location depends on your installation) or run a simple netstat -a command. I believe 10000 is the default port number, so it might make sense to try out 10000 directly.

这篇关于在 SQLClient 中访问 Hive 表,但不能从 Putty 访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆