【问题标题】:Transport exception传输异常
【发布时间】:2013-01-20 00:43:29
【问题描述】:

我正在尝试导入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

【问题讨论】:

  • 另一端的程序是否在 localhost:9090 上列出?您可以通过 telnet 访问它来查看它。

标签: python hadoop hbase thrift


【解决方案1】:

确保在尝试连接之前已启动 Thrift 服务器。

hbase thrift start -threadpool

【讨论】:

  • 另外,hbase/bin/hbase-daemon.sh start thrift.
【解决方案2】:
connection = happybase.Connection('localhost','2181')

【讨论】:

  • 请为您的答案添加更多解释。就目前而言,我不确定这在多大程度上解决了这个问题。 (另外,作为一项建议,您可以通过在行首添加四个空格来使一行显示不带格式(就好像它在终端中一样)。
  • 当您开始 thrift 时,您将能够通过读取它的标准输出来查看它正在使用的端口。
【解决方案3】:

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

nohup hbase thrift start &

使用前在python中打开连接:

connection.open()

例子:

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

【讨论】:

  • connection.open() 仅在 autoconnect=False 时才需要调用。 autoconnect 的默认值为 True
【解决方案4】:

这对我有用:

sudo server hbase-thrift restart 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-03
    • 2013-07-09
    • 2015-08-04
    • 1970-01-01
    • 1970-01-01
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多