运输异常

时间:2013-02-05 06:40:55

标签: python hadoop hbase thrift

我正在尝试导入happybase,但在连接时会收到以下错误消息。 我有Hadoop伪节点集群和Hbase已经运行。 安装的组件版本如下, Hadoop版本 - 1.0.4 Hbase版本 - 0.94.4 happybase -0.4

有人可以查看下面的例外情况并告知我们,如果有任何节俭特定设置或任何指导来解决此问题。

谢谢。

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import happybase

connection = happybase.Connection('localhost')

Traceback (most recent call last):

 File "<stdin>", line 1, in <module>
    File "/Library/Python/2.6/site-packages/happybase/api.py", line 121, in __init__
    self.open()

    File "/Library/Python/2.6/site-packages/happybase/api.py", line 138, in open
    self.transport.open()

    File "/Library/Python/2.6/site-packages/thrift/transport/TTransport.py", line 149, in open
    return self.__trans.open()

    File "/Library/Python/2.6/site-packages/thrift/transport/TSocket.py", line 99, in open
    message=message)

    thrift.transport.TTransport.TTransportException: Could not connect to localhost:9090

4 个答案:

答案 0 :(得分:8)

确保在尝试连接之前启动了thrift服务器。

hbase thrift start -threadpool

答案 1 :(得分:0)

thrift服务器必须启动并运行。您的连接也必须打开:

nohup hbase thrift start &

使用前在python中打开连接:

connection.open()

示例:

#!/usr/bin/python
import happybase
connection = happybase.Connection('localhost', autoconnect=False)
connection.open()

答案 2 :(得分:0)

connection = happybase.Connection('localhost','2181')

答案 3 :(得分:0)

这对我有用:

sudo server hbase-thrift restart