hiveserver2对端口10000没有响应

时间:2015-11-18 23:31:20

标签: apache hive

apache hive是否有联系地点我可以向他们提问?我已经尽了一切努力,但它仍然无效。

现在,当我启动hiveserver时,我仍然会遇到错误。 使用hive_service库我收到错误

方法名称无效:'执行'

当我调用client.execute

当我尝试使用pyhs2时,我得到了这个输出

Traceback (most recent call last):
  File "test1.py", line 8, in <module>
    database='default') as conn:
  File "/home/sakib/anaconda/lib/python2.7/site-packages/pyhs2/__init__.py", line 7, in connect
    return Connection(*args, **kwargs)
  File "/home/sakib/anaconda/lib/python2.7/site-packages/pyhs2/connections.py", line 46, in __init__
    transport.open()
  File "/home/sakib/anaconda/lib/python2.7/site-packages/pyhs2/cloudera/thrift_sasl.py", line 74, in open
    status, payload = self._recv_sasl_message()
  File "/home/sakib/anaconda/lib/python2.7/site-packages/pyhs2/cloudera/thrift_sasl.py", line 92, in _recv_sasl_message
    header = self._trans.readAll(5)
  File "/home/sakib/anaconda/lib/python2.7/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz-have)
  File "/home/sakib/anaconda/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 94, in read
    raise TTransportException('TSocket read 0 bytes')
thrift.transport.TTransport.TTransportException: None

以下是我与hive连接的示例python脚本

import sys

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

try:
  print "1111"
  transport = TSocket.TSocket('localhost', 10000)
  transport = TTransport.TBufferedTransport(transport)
  protocol = TBinaryProtocol.TBinaryProtocol(transport)
  print "2222"
  client = ThriftHive.Client(protocol)
  transport.open()
  print "3333"

  client.execute("CREATE TABLE r(a STRING, b INT, c DOUBLE)")

  print "4444"
  transport.close()
except Thrift.TException, tx:
  print '%s' % (tx.message)

import pyhs2

with pyhs2.connect(host='localhost',
               port=10000,
               authMechanism="PLAIN",
               user='root',
               password='',
               database='default') as conn:
    with conn.cursor() as cur:
        #Show databases
        print cur.getDatabases()

0 个答案:

没有答案