简体   繁体   English

Eclipse RSE连接到远程计算机上的localhost

[英]Eclipse RSE connect to a localhost on a remote machine

I'm trying to work with Hbase, thrift, and python on a remote machine(Ubuntu) from Eclise RSE on windows. 我正试图在Windows上的Eclise RSE远程机器(Ubuntu)上使用Hbase,thrift和python。 Everything is working fine but when I'm trying to connect to the localhost I get an error: 一切正常,但当我尝试连接到localhost时,我收到一个错误:

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

If I run this code via ssh terminal on a remote machine, it works perfectly. 如果我通过远程机器上的ssh终端运行此代码,它可以正常工作。

Here is my code: 这是我的代码:

#!/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() 

Do you know what localhost means? 你知道localhost的意思吗? It means the machine you're running the command on. 它表示您正在运行命令的计算机。 Eg if I type http://localhost:8080/ in a browser on my PC then it will call the server running on port 8080 on MY machine. 例如,如果我在我的PC上的浏览器中输入http:// localhost:8080 /那么它将调用在我的机器上的端口8080上运行的服务器。

I'm sure your connection worked fine if you tried connecting to localhost while on the same box. 如果您尝试在同一个盒子上连接到localhost,我确定您的连接正常。 If connecting from a different machine then you'll need to know the IP address or the hostname of the box you're connecting to. 如果从另一台计算机连接,则需要知道要连接的盒子的IP地址或主机名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Pydev 和 RSE Server 在远程 Linux 机器上定义远程解释器 - Define remote interpreter on remote Linux machine using Pydev and RSE Server 使用子进程连接到远程机器 - Connect to remote machine using subprocess 无法从远程计算机连接到Cassandra服务器 - Unable to connect to Cassandra server from a remote machine 连接到远程机器中的数据库 - python - SQL Server - Connect to database in Remote machine - python - SQL Server 无法连接到远程机器上运行的 mongodb - Unable to connect to mongodb running on a remote machine 如何使用远程客户端计算机连接到本地计算机 - how to connect to local machine using remote client machine Django mongoengine无法连接到远程服务器,始终连接到本地主机 - Django mongoengine not connect to remote server, always connect to localhost Ansible 可以从 localhost 连接到 windows 机器,但不能从 docker 容器连接 - Ansible can connect to windows machine from localhost but not from docker container 如何连接到远程 Windows 机器以使用 python 执行命令? - How to connect to a remote Windows machine to execute commands using python? 如何获得pywinrm连接到远程Windows计算机? - How can I get pywinrm to connect to a remote Windows machine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM