0
我正尝试从Windows上的Eclise RSE远程计算机(Ubuntu)上使用Hbase,thrift和python。一切工作正常,但是当我试图连接到本地主机我得到一个错误:Eclipse RSE连接到远程计算机上的本地主机
thrift.transport.TTransport.TTransportException: Could not connect to localhost:9090
如果我在远程机器上运行通过SSH终端这段代码,它完美的作品。
这里是我的代码:
#!/usr/bin/env python
import sys, glob
sys.path.append('gen-py')
sys.path.insert(0, glob.glob('lib/py/build/lib.*')[0])
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
# Connect to HBase Thrift server
transport = TTransport.TBufferedTransport(TSocket.TSocket('localhost', 9090))
protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
# Create and open the client connection
client = Hbase.Client(protocol)
transport.open()
tables = client.getTableNames()
print(tables)
# Do Something
transport.close()