2

全部,

我正在尝试使用 Python 的 Thrift 库在 Python 脚本中运行配置单元查询。我能够运行不执行 M/R 之类的查询create tableselect * from table等等。但是当我执行执行 M/R 作业的查询(例如select * from table where...)时,我得到以下异常。

starting hive server...

Hive history file=/tmp/root/hive_job_log_root_201212171354_275968533.txt
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
  set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
  set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
  set mapred.reduce.tasks=<number>
java.net.ConnectException: Call to sp-rhel6-01/172.22.193.79:54311 failed on connection exception: java.net.ConnectException: Connection refused

Job Submission failed with exception 'java.net.ConnectException(Call to sp-rhel6-01/172.22.193.79:54311 failed on connection exception: java.net.ConnectException: Connection refused)'
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MapRedTask

我有一个多节点hadoop集群,我的配置单元安装在namenode中,我也在同一个namenode上运行python脚本。

python脚本是

from hive_service import ThriftHive
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol

transport = TSocket.TSocket('172.22.193.79', 10000)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)

client = ThriftHive.Client(protocol)
transport.open()

client.execute("select count(*) from example ")
print client.fetchAll();
transport.close()

谁能帮我理解什么是错的?

-苏珊特

4

1 回答 1

0

尽管我可以完成和查询SELECT,但我无法完成查询。我解决这个问题的方法是重新启动集群上的服务。我正在使用 Cloudera 来管理我的集群,所以我运行的命令是. 我没有花太多时间调试,但我猜测 NN 或 JT 崩溃了。有趣的是我仍然可以完成对元数据的查询。我最好的猜测是查询直接进入元存储,而不必触及 HDFS。不过,我需要有人来证实这一点。SHOWDESCRIBE$ sudo /etc/init.d/cloudera-scm-agent hard_restart

于 2013-06-07T14:30:05.653 回答