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()